I develop a web by using ASP.NET MVC2. Creating the cookie in the background. Then I want to get the cookie value in IE by using javaScript,but the value is messy code when I set it in chinese.
document.cookie:
userID=1017030057 userName=涓浗
Then I check the cookie in my computer.It is normal:
userID
1017030057
localhost/
1536
3361761792
30304298
1345470592
30230873
*
userName
中国
localhost/
1536
3361761792
30304298
1345470592
30230873
*
ID
22
localhost/
1536
3361761792
30304298
1345470592
30230873
*
This case only happen in IE. In other browser, the cookie value is normal.
My IE is IE8. The page headers conforms the IE charset issue, and presents normal in chinese except the cookie value.
try encoding the cookie on server side and use
decodeURIComponent(cookieValue)in JS. let me know if that works