[英]Non-ASCII characters incorrectly displayed in Denmark webfont
My problem is so weird, I should display the following letters ø å Å Ø
but I see øåÅØ
, 我的问题是太奇怪了,我应显示以下文字ø å Å Ø
但我看到øåÅØ
,
This is my code: 这是我的代码:
<html>
<head>
<link rel="stylesheet" href="style.css" type="text/css" charset="utf-8" />
</head>
<body>
<p class="denmark-font">
øåÅØ
</p>
</body>
</html>
And this is my css
code: 这是我的css
代码:
@font-face {
font-family: 'denmarkregular';
src: url('denmark-webfont.eot');
src: url('denmark-webfont.eot?#iefix') format('embedded-opentype'),
url('denmark-webfont.woff') format('woff'),
url('denmark-webfont.ttf') format('truetype'),
url('denmark-webfont.svg#denmarkregular') format('svg');
font-weight: normal;
font-style: normal;
}
.denmark-font{
font-family: 'denmark-webfont', Arial, sans-serif;
font-size:50px;
}
If you see ø å Å Ø as øåÅØ, then the data is in fact UTF-8 encoded but processed as windows-1252 encoded. 如果您将øÅØØ视为øåÅÄ,那么数据实际上是UTF-8编码的,但将其处理为Windows-1252编码的。 You need to check the character encoding issues. 您需要检查字符编码问题。
Modern browsers will use UTF-8 if the file starts with bytes that constitute Byte Order Mark (BOM) when interpreted as UTF-8. 如果文件以构成字节顺序标记(BOM)的字节开头(被解释为UTF-8),则现代浏览器将使用UTF-8。 So apparently the file was saved (or generated) as “UTF-8 without BOM”. 因此,显然该文件已保存(或生成)为“没有BOM的UTF-8”。 Saving as “UTF-8 with BOM” should fix the situation. 另存为“带有BOM的UTF-8”应该可以解决这种情况。
Alternative, check the HTTP headers and make the server announce UTF-8 in the Content-Type
header. 或者,检查HTTP标头,并使服务器在Content-Type
标头中宣布UTF-8。
If the encoding is not specified in either of the above ways, browsers will use the encoding specified in a meta
tag or, in its absence, make their guess. 如果以上两种方式均未指定编码,则浏览器将使用meta
标记中指定的编码,如果没有,则进行猜测。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.