UTF-8 服务器编码结果为 � ASP.NET 站点上的字符
我正在 maxpavlov.com 上运行一个 ASP.NET WebForms 博客引擎 网站,
我的博客上主要用俄语写作。有时,即使我正在编写完全正常的俄语字符,当我查看生成的渲染博客文章页面时,我会看到一些符号被 �� 字符替换。
我开始挖掘。首先,我检查了 web.config 的全球化部分中是否将 UTF-8 设置为响应编码。一直如此。然后我注意到,我的网站生成的页面没有 页眉中提供的属性。因此,我已将其添加到两个母版页(显示母版页和管理母版页 - 这是 blogengine.net 的特定内容)。
现在,Web 服务器生成的所有页面的字符集值都设置为 UTF-8,但问题仍然存在。
当我创建博客文章时,该网站将其保存到 XML 文件,该文件还在 XML 文件顶部将编码设置为 UTF-8,其中包含以下行:
尽管如此,当我访问我的网站时,问题字符仍出现在浏览器中。
我还应该在哪里解决这个编码问题?
更多信息:Fiddler 告诉我响应头 Content-Type: text/html; charset=utf-8
有趣的是,在不同的浏览器中,HTTP 响应中的不同字符会被替换为 �。
I am running an ASP.NET WebForms blog engine web site at maxpavlov.com
I am writing mostly in Russian on my blog. Sometimes, even though I am writing a perfectly normal Russian characters in, when I view the resulting rendered blog post page, I get some symbols substituted with �� characters.
I started digging. First, I have checked to see if a UTF-8 is set as a response encoding in the globalization section in web.config. It always was. Then I have noticed, that the pages my site generate don't have a <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
attibute provided in the page header. So I have added it to both masterpages (the display one, and the admin one - it is blogengine.net's specific stuff).
Now all pages that the web server generates have the charset value set to UTF-8, but the problem remains.
The site, when I create a blog post saves it to XML file, that also has an encoding set at the top of the XML file to UTF-8 with the following line:<?xml version="1.0" encoding="utf-8" standalone="yes"?>
Still, problem characters appear in the browsers, when I go to my site.
Where else should I fix this encoding problem?
More info: Fiddler tells me that the response header Content-Type: text/html; charset=utf-8
What is interesting, is that in different browsers, different characters in the HTTP Response get substituted with a �.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
顺便说一句,如果有人仍然想知道这是什么东西,那就是 IIS Native RewriteModule。即使在版本 2 中也存在错误,如果您为站点禁用它,问题就会消失。试图在 IIS.net 中报告它 - 不相信我。刚刚学会在需要显示西里尔字符的网站上没有它的生活。
By the way, if anyone still wonders what the thing is - it's IIS Native RewriteModule. It's buggy even in version 2, if you disable it for the site, the problem goes away. Tried to report it in IIS.net - didn't believe me. Just learned to live without it on web sites that need to display a cyrillic characters.
尝试对俄语字母使用
Windows-1251
(西里尔字母)编码。Try using
Windows-1251
(cyrillic) encoding for the russian alphabet.