Unicode Cookie Value

2020-04-20 23:57发布

I am about to start to make a cookie with Unicode value (Japanese characters) is there any problem with Unicode Cookie value? in IE 7 IE 8 Firefox, Safari, Chrome?

Thank you

3条回答
够拽才男人
2楼-- · 2020-04-21 00:04

Technically speaking, the content of the cookie value is opaque and can be anything the server wants, even binary data, as long as the resulting HTTP headers follow the rules of the HTTP specifications. By convention, most servers encode non-ASCII data, typically with URL-encoding (a non-ASCII byte is represented as "%XX", where XX is the hex value of the byte).

查看更多
等我变得足够好
3楼-- · 2020-04-21 00:19

I found out that Russian characters are not working as cookie values in iPhone browsers (Chrome, Safari), so I had to convert to base64. Although the same code worked well in desktop browsers without a need to convert to anything.

查看更多
别忘想泡老子
4楼-- · 2020-04-21 00:29

you can't transfer Unicode like that in headers, you might need to encode it into base64 or quoted-printable

查看更多
登录 后发表回答