封云亭 发表于 2017-5-2 12:18:05

App Engine上ajax请求python中文乱码问题

python对utf-8编码的支持真让人恼火。在Google App Enginea上发ajax请求时,有中文字符时,乱码问题很让人头痛。尝试了一种解决方法是可行的:

[*]浏览器端使用encodeURIComponent或者encodeURI编码中文字符;
[*]服务器端使用urllib模块的unquote方法:


str= urllib.unquote(ajaxChineseString.encode("utf-8"))
页: [1]
查看完整版本: App Engine上ajax请求python中文乱码问题