Unicode cookie value

I'm going to start making cookies with a Unicode index (Japanese characters), are there any problems with Unicode Cookies? in IE 7 IE 8 Firefox, Safari, Chrome?

thanks

+1
source share
3 answers

From a technical point of view, the content of the cookie value is opaque and can be anything that the server requires, even binary data, if the received HTTP headers comply with the rules of the HTTP specifications. By convention, most servers encode non-ASCII data, usually with URL encoding (non-ASCII byte is represented as "% XX", where XX is the hexadecimal value of the byte).

+3
source

you cannot transfer Unicode to headers, you may need to encode it in base64 or quotation marks

+1
source

I found out that Russian characters do not work 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 having to convert to anything.

0
source

Source: https://habr.com/ru/post/1213356/


All Articles