简体   繁体   English

utf-8编码文件中无法正确显示特殊字符

[英]special characters not being displayed correctly in utf-8 encoded file

I have a strange situation. 我有一个奇怪的情况。 I am specifying utf-8 in the meta data of my html file: 我在html文件的元数据中指定utf-8:

<!DOCTYPE html>
    <head>
         <meta charset="utf-8" />
         <meta name="viewport" content="width=device-width" />
         ....
   </head>
   <body>
        <? include("extras.php"); ?>
   </body>
</html>

but my speacial characters "ä, ö, å" are being display incorrectly. 但是我的特殊字符“ä,ö,å”显示不正确。

Even more strange through is that the same characters used int the included file (hard coded no loaded from php), are being displayed correctly? 更奇怪的是,包含文件中使用的相同字符(硬编码未从php加载)是否正确显示?

can anyone enlighten me as to why this might be? 有人能启发我为什么会这样吗?

Encode the special characters, for example, the letter ä you should encode as &#228; 编码特殊字符,例如字母ä您应将其编码为&#228;
You can use an HTML encoder/decoder (there are many available online): http://www.opinionatedgeek.com/DotNet/Tools/HTMLEncode/encode.aspx 您可以使用HTML编码器/解码器(在线提供很多): http : //www.opinionatedgeek.com/DotNet/Tools/HTMLEncode/encode.aspx

or do it programmatically . 或以编程方式进行

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM