开发者

Chinese encoding issue

I send some Chinese character via query string

Chinese encoding issue

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" />
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜