Jump to content

How to store other languages (unicode) in cookies and get it back again


Sherzod

Recommended Posts

How to store other languages (unicode) in cookies and get it back again
var cookieValue = document.getElementsByTagName('input')[0].value;
document.cookie = "lboxcook=" + encodeURIComponent(cookieValue);

function get_cookie(cookie_name) {
var results = document.cookie.match ('(^| ?' + cookie_name + '=([^;]*)(;|$)');
return results ? decodeURIComponent(results[2]) : null;
}
Farshad, I think in the future, by default, you can use this approach when saving cookies
 
Sincerely.

 

  • Upvote 2
Link to comment
Share on other sites

  • 3 years later...
Unicode write read cookie

  

uses System.NetEncoding

 

//write cookie

UniApplication.Cookies.SetCookie(CookieName,CookieValue, 0, False, False, '');

 

//read cookie

strval=TNetEncoding.Base64.decode(UniApplication.Cookies[CookieName]);

Link to comment
Share on other sites

×
×
  • Create New...