1

I am from Vietnam (we use special characters). I would like to save a cookie value in unicode encoding to preserve those special characters, but I don't know how to proceed.

Jeff Noel
  • 7,500
  • 4
  • 40
  • 66
Hung Pham Do
  • 21
  • 2
  • 5

1 Answers1

6

Quốc Ngữ characters can be represented in Unicode - in consequence, you may use theencodeURIComponent() function to set the cookie content, and then thedecodeURIComponent() function to get the original value back.

There's a neat post here about this, How to store other languages (unicode) in cookies and get it back again.

Community
  • 1
  • 1
OnoSendai
  • 3,960
  • 2
  • 22
  • 46