gpt4 book ai didi

html - 丹麦 webfont 中的非 ASCII 字符显示不正确

转载 作者:太空宇宙 更新时间:2023-11-04 14:09:58 26 4
gpt4 key购买 nike

我的问题很奇怪,我应该显示以下字母 ø å Å Ø 但我看到了 øåÃ...ã

这是我的代码:

<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 标记中指定的编码,或者在没有标记的情况下进行猜测。

关于html - 丹麦 webfont 中的非 ASCII 字符显示不正确,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20856784/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com