简体   繁体   中英

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:

<!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?

can anyone enlighten me as to why this might be?

Encode the special characters, for example, the letter ä you should encode as &#228;
You can use an HTML encoder/decoder (there are many available online): http://www.opinionatedgeek.com/DotNet/Tools/HTMLEncode/encode.aspx

or do it programmatically .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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