Bakhtiyor
Bakhtiyor

Reputation: 7318

Why charset=utf-8 is not working in some servers?

I have following html file (1.html) and once I open it in my browser it opens and shows Russian letters correctly. But once I upload it to another server and browse it, it shows Russian letters incorrectly.

What could be the possible problems here?

The content of the html file:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
    <head>
        <title>Заголовок сайта</title>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    </head>
    <bod>
    <p>Русский шрифт</p>
    </body>
</html>

Here is how it is shown:

enter image description here

Upvotes: 3

Views: 1162

Answers (1)

ThiefMaster
ThiefMaster

Reputation: 318748

If the server sends a Content-type header containing a charset the charset specified in that header takes priority over the one specified in the HTML document.

In case you are using Apache you can add the following to a .htaccess file to force the correct header:

AddDefaultCharset UTF-8

Upvotes: 3

Related Questions