Home | History | Annotate | Download | only in resources
      1 <!DOCTYPE HTML>
      2 <meta http-equiv="Content-Type" content="text/html;charset0charset=ISO-8859-9">
      3 <p>Test:
      4 <pre>&lt;!DOCTYPE HTML>
      5 &lt;meta http-equiv="Content-Type" content="text/html;charset0charset=ISO-8859-9"></pre>
      6 <p>Expected result: <span id="expected">Windows-1254</span>
      7 <div>
      8  <style scoped>
      9   .pass { background: green; color: white; padding: 0.5em; font-weight: bold; }
     10   .fail { background: red; color: yellow; padding: 0.5em; font-weight: bold; }
     11  </style>
     12  <p>Encoding used by browser is: <span id="encoding">Script did not run.</span>
     13  <p>Result: <span id="result">Script did not run.</span>
     14  <script>
     15    var encoding = 'unknown';
     16    if ('' == '\u00E0') { // 0xE0
     17      if ('' == '\u2122') { // 0x99
     18        if ('' == '\u00FE') // 0xFE
     19          encoding = 'Windows-1252';
     20        else if ('' == '\u015F')
     21          encoding = 'Windows-1254';
     22        else if ('' == '\u200F')
     23          encoding = 'Windows-1256';
     24        else if ('' == '\u20AB')
     25          encoding = 'Windows-1258';
     26        else
     27          encoding = 'unknown with 0xE0 = U+00E0 and 0x99 = U+2122';
     28      } else if ('' == '\u02D9') // 0xFF
     29        encoding = 'ISO-8859-3';
     30      else if ('' == '\u0177') // 0xFE
     31        encoding = 'ISO-8859-14';
     32      else if ('' == '\u021B')
     33        encoding = 'ISO-8859-16';
     34      else if ('' == '\u015F')
     35        encoding = 'ISO-8859-9';
     36      else if ('' == '\u00BE') // 0xBE
     37        encoding = 'ISO-8859-1';
     38      else if ('' == '\u0178')
     39        encoding = 'ISO-8859-15';
     40      else
     41        encoding = 'unknown with 0xE0 = U+00E0';
     42    } else if ('' == '\u0101') // 0xE0
     43      encoding = 'ISO-8859-10';
     44    else if ('' == '\u0E40') // 0xE0
     45      encoding = 'ISO-8859-11';
     46    else if ('' == '\uFFFD') { // 0xE0
     47      if ('' == '\u263A') // 0xE2 0x98 0xBA
     48        encoding = 'UTF-8';
     49      else
     50        encoding = 'unknown (but ASCII-compatible)';
     51    }
     52    document.getElementById('encoding').firstChild.data = encoding;
     53    var expected = document.getElementById('expected').firstChild.data;
     54    if (expected == '(demo - no expected result)') {
     55      document.getElementById('result').firstChild.data = 'demo';
     56    } else if (encoding == expected) {
     57      document.getElementById('result').firstChild.data = 'PASS';
     58      document.getElementById('result').className = 'pass';
     59    } else {
     60      document.getElementById('result').firstChild.data = 'FAIL';
     61      document.getElementById('result').className = 'fail';
     62    }
     63    if (parent.receivedResults)
     64      parent.receivedResults();
     65  </script>
     66 </div>
     67