HASSAROV
HASSAROV

Reputation: 29

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:

@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;
}

Upvotes: 0

Views: 473

Answers (1)

Jukka K. Korpela
Jukka K. Korpela

Reputation: 201568

If you see ø å Å Ø as øåÅØ, then the data is in fact UTF-8 encoded but processed as windows-1252 encoded. 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. So apparently the file was saved (or generated) as “UTF-8 without BOM”. Saving as “UTF-8 with BOM” should fix the situation.

Alternative, check the HTTP headers and make the server announce UTF-8 in the Content-Type header.

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.

Upvotes: 1

Related Questions