1

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

Makoto
  • 104,088
  • 27
  • 192
  • 230
bbnn
  • 3,505
  • 10
  • 50
  • 68

3 Answers3

3

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).

Remy Lebeau
  • 555,201
  • 31
  • 458
  • 770
1

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

Andrey
  • 59,039
  • 12
  • 119
  • 163
0

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.

exebook
  • 32,014
  • 33
  • 141
  • 226
  • Thanks for an idea. I've met the same in Safari on both iphone and Mac. I've applyed of encodeURIComponent - all is working. – PokatilovArt Feb 17 '22 at 22:38