import urllib.parse
import re


def encode_chinese_in_url(url):
    # 定义一个函数来对匹配的中文部分进行编码
    def encode_match(match):
        return urllib.parse.quote(match.group(0))

    # 使用正则表达式找到所有中文字符,并调用encode_match函数进行编码
    encoded_url = re.sub(r'[\u4e00-\u9fff]+', encode_match, url)

    return encoded_url