How to force Internet Explorer to use the encoding specified in the meta tag?

I am trying to prepare a html demo page with mixed English and Arabic content. It mainly contains a small table with English phrases on the left and an Arabic translation on the right.

Because I don’t understand Arabic, I took the first three characters of the Arabic alphabet from Unicode Link .

First attempt, using the character entities (& # x0627; & # x0628; & # x062A;): it works (display: ا ب ت).

I tried to enter Arabic characters directly in the document. To enable this, I saved the document as UTF-8 and added a meta tag for the content type.

Displaying this document in Internet Explorer (7) shows garbage: ا ب ت

Manually switching IE to use UTF-8 (the menu "View → View → Unicode") forces IE to show matching characters. But as soon as the document is reloaded, the garbage appears again.

<html>
  <head>
  <meta content="content-type" content="text/html; charset=utf-8">
  </head>
  <body>
    <table width="95%" border="1">
      <colgroup><col width="50%" /><col width="50%" /></colgroup>
      <tbody>
        <tr>
          <th>English</th><th>Arabic</th>
        </tr>
        <tr>
          <td>Test phrase</td>
          <td dir="rtl">ا ب ت</td>
        </tr>
      </tbody>
    </table>
  </body>
</html>

Testing with Firefox shows the correct Arabic letters. (But the interpretation of the rtl direction is different: IE shows text alignment, left alignment).

Any hints on how to convince IE to use the encoding specified in the document?

Is this the effect of locally stored html files? While editing this StackOverflow post I observe

  • Arabic characters are displayed as expected.
  • the encoding in the menu automatically switches to "Unicode (UTF-8)",
  • and the html source does not contain a meta tag for the content type.
+3
2

, . :

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
      ^ you had 'content' here,   and forgot to close the tag here ^

IE7 , , . IE8

+9

:

<table width="95%" border="1">
  <colgroup><col width="50%" /><col width="50%" /></colgroup>
  <tbody>
    <tr>
      <th>English</th><th>Arabic</th>
    </tr>
    <tr>
      <td>Test phrase</td>
      <td dir="rtl">ا ب ت</td>
    </tr>
  </tbody>
</table>

0

Source: https://habr.com/ru/post/1710051/


All Articles