我的问题很奇怪,我应该显示以下字母 ø å Å Ø
但我看到了 øåÃ...ã
,
这是我的代码:
<html>
<head>
<link rel="stylesheet" href="style.css" type="text/css" charset="utf-8" />
</head>
<body>
<p class="denmark-font">
øåÅØ
</p>
</body>
</html>
这是我的 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;
}
如果您看到 ø å Å Ø 为 øåÅÃ,那么数据实际上是 UTF-8 编码的,但处理为 windows-1252 编码。您需要检查 character encoding问题。
如果文件以构成字节顺序标记 (BOM) 的字节开头并解释为 UTF-8,则现代浏览器将使用 UTF-8。很明显,文件被保存(或生成)为“UTF-8 without BOM”。保存为“带 BOM 的 UTF-8”应该可以解决这个问题。
或者,检查 HTTP header 并让服务器在 Content-Type
header 中声明 UTF-8。
如果未以上述任何一种方式指定编码,浏览器将使用 meta
标记中指定的编码,或者在没有标记的情况下进行猜测。
我是一名优秀的程序员,十分优秀!