前后端“中文编码”问题

前端:JQ

// 待发字符串:str = "这是要发的字符串"
var str_encode = encodeURI(str)   //[gbk编码]
// str_encode = %E3%80%8C%E3%82%82%E3%81%86%E5%B0%84%E7%B2

后端:Python

from urllib.request import unquote
// str_encode = %E3%80%8C%E3%82%82%E3%81%86%E5%B0%84%E7%B2
str_decode = unquote(str_encode)
// str_decode = "这是要发的字符串"

猜你喜欢

转载自blog.csdn.net/weixin_34327761/article/details/87159351