如何停止Server.HtmlEncode对UTF8字符进行编码?
如何停止 Server.HtmlEncode 对 UTF8 字符进行编码?我将代码页设置为 UTF8 但没有帮助
这是我的测试用例:
<%@CODEPAGE=65001%>
<%
Response.CodePage = 65001
Response.CharSet = "utf-8"
%>
<%=Server.HtmlEncode("русский stuff <b>bold stuff</b>")%>
它通常应该输出这个:
русский stuff <b>bold stuff</b>
但输出是:
русский stuff <b>bold stuff</b>
How can I stop Server.HtmlEncode to encode UTF8 characters? I set the codepage to UTF8 but didn't help
Here is my test case:
<%@CODEPAGE=65001%>
<%
Response.CodePage = 65001
Response.CharSet = "utf-8"
%>
<%=Server.HtmlEncode("русский stuff <b>bold stuff</b>")%>
It should normally output this:
русский stuff <b>bold stuff</b>
but the output is:
русский stuff <b>bold stuff</b>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
![扫码二维码加入Web技术交流群](/public/img/jiaqun_03.jpg)
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Server.HtmlEncode 方法转义 >,<,&," 字符以及任何代码大于或等于 0x80 的 ascii 代码字符。
您可以过滤哪个字符将会被逃脱。
有通用字符将被编码在模式中。
如果您愿意,您也可以添加一些其他字符。
Server.HtmlEncode method escapes >,<,&," chars and any ascii code character whose code is greater than or equal to 0x80.
You can filter which character will be escaped.
There are generic characters will be encoded in pattern.
If you prefer, you can add some other chars too.