Chinese encoding issue
I send some Chinese character via query string
but the page that receives them does not display them correctly. In particular, it must display them in <input type="text" />
. How to settl开发者_高级运维em down the problem?
You will want to use UTF-8:
Response.Codepage = 65001
Response.CharSet = "UTF-8"
Change your input tag to something like:
<input type="text" value="<%=Server.HTMLEncode(Request.QueryString("word"))%>" />
Server.HTMLEncode will prevent XSS attacks and also help browsers render the correct characters.
If you still have issues, you will want to add the following in your before the </head>
in your HTML.
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
精彩评论