HTML 中的奇数字符
中显示奇怪的字符
在某些浏览器中,在 HTML .cshtml
<h3>Cadastre seu currículo e faça parte da equipe Let’s Go.</h3>
生成的 HTML
Metas
<meta name="title" content="Let's Go Festas" />
<meta name="url" content="http://letsgofestas.com.br" />
<meta name="description" content="isto é um teste" />
<meta name="keywords" content="teste" />
<meta name="charset" content="ISO-8859-1" />
<meta name="autor" content="Bind Solution" />
<meta name="company" content="Let's Go Festas" />
<meta name="revisit-after" content="10" />
<meta name="viewport" content="width=device-width" />
<meta name="robots" content="index,follow" />
<meta name="googlebot" content="all" />
<meta name="classification" content="Internet" />
<meta name="publisher" content="Bind Solution" />
<meta name="copyright" content="Bind Solution" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
**注意:** 例如在 Chrome 中,这种情况不会发生!
In some browsers is showing a strange character in HTML
.cshtml
<h3>Cadastre seu currículo e faça parte da equipe Let’s Go.</h3>
Generated HTML
Metas
<meta name="title" content="Let's Go Festas" />
<meta name="url" content="http://letsgofestas.com.br" />
<meta name="description" content="isto é um teste" />
<meta name="keywords" content="teste" />
<meta name="charset" content="ISO-8859-1" />
<meta name="autor" content="Bind Solution" />
<meta name="company" content="Let's Go Festas" />
<meta name="revisit-after" content="10" />
<meta name="viewport" content="width=device-width" />
<meta name="robots" content="index,follow" />
<meta name="googlebot" content="all" />
<meta name="classification" content="Internet" />
<meta name="publisher" content="Bind Solution" />
<meta name="copyright" content="Bind Solution" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
**NOTE: ** In chrome for example , this does not occur!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
这些字符是 utf-8 或更可能是杂散字符,但您的字符编码是 iso-8859。您在头部显示两种编码。将其更改为 utf-8 和/或删除这些字符。但我认为那些都是流浪者。
Those characters are utf-8 or more likely strays but your character encoding is iso-8859. You are showing both encodings in the head. Change it to utf-8 and/or remove those characters. I think those are strays, though.
我在一个非常特殊的情况下遇到了这个问题:当我将文本从 MS Word 复制/粘贴到 Wordpress 时。我不知道你使用的是什么系统 - 但是,我发现必须修复它:
假设你的句子是“See Jane [WEIRD CHARACTER]Run”。
我确实必须进去并删除句子中间的“e R”,然后手动将其重新输入。我知道这很奇怪。但似乎有一个奇怪的空间角色被困在那里。
I've run into this issue in a very specific circumstance: when I copied/pasted text out of MS Word into Wordpress. I don't know what system you're using - but, what I found had to happen to fix it:
Let's say your sentence is "See Jane [WEIRD CHARACTER]Run."
I literally had to go in and delete "e R" in the middle of the sentence, then manually type that back in. Odd, I know. But there seemed to be an odd space character that just got stuck in there.
通过 validator 运行您的网站,看看它是否捕获任何编码问题,您可能有编码问题,或者您的文档可能存在编码问题保存为 UTF-8 以外的格式(例如 BOM UTF-8)。
Run your site through a validator and see if it catches any enconding issues, you might have enconding issues or your document might be saved as something other than UTF-8 (such as BOM UTF-8).
我曾经遇到过类似的问题,发现除了元标记之外,我还必须设置响应标头。我不知道你使用的是什么语言,但是在Java中,它是这样的:
response.setCharacterEncoding("UTF-8");
I had a similar issue once and found that in addition to the meta tags, I had to set the response header as well. I don't know what language you're using, but in Java, it is something like this:
response.setCharacterEncoding("UTF-8");