python 解决cookie 传递中文 与 获取的问题
作者:互联网
1. 设置的时候
ret = render(request, 'login.html') ret.set_cookie("username", "张三".encode('utf-8').decode('latin-1')) return ret
2. 获取
username = request.COOKIES.get("username") username = username.encode('latin-1').decode('utf-8')
简简单单
标签:username,中文,latin,python,ret,decode,cookie,encode 来源: https://www.cnblogs.com/fmg0224/p/16335442.html