Cookie value is messy code in IE

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.

Answers


try encoding the cookie on server side and use decodeURIComponent(cookieValue) in JS. let me know if that works


Need Your Help

SQL Server 2005 / XML Stored Proc - Unicode to ascii? (Exception 0xc00ce508)

sql-server-2005 tsql stored-procedures unicode

I have an MSSQL2005 stored procedure here, which is supposed to take an XML message as input, and store it's content into a table.

Using CURSOR to fetch multiple table names from another table

sql oracle plsql

I've created one table "Meta_Data_Table_Names" where I inserted forty eight table names in the MetaTableName column. And there is another column to provide Row count with corresponding table ...