OLD | NEW |
(Empty) | |
| 1 <!doctype html> |
| 2 <script src="/js-test-resources/js-test.js"></script> |
| 3 <script> |
| 4 window.jsTestIsAsync = true; |
| 5 description('BOM can override the encoding when decoding the response in ' + |
| 6 'responseText.'); |
| 7 |
| 8 xhr = new XMLHttpRequest; |
| 9 xhr.open('GET', 'resources/bom-utf-8.php'); |
| 10 xhr.onreadystatechange = function() { |
| 11 if (xhr.readyState != xhr.DONE) { return; } |
| 12 // A string with utf-8 BOM is decoded as utf-8. |
| 13 shouldBeEqualToString('xhr.responseText', |
| 14 '\u4e09\u6751\u304b\u306a\u5b50'); |
| 15 xhr2 = new XMLHttpRequest; |
| 16 xhr2.open('GET', 'resources/bom-utf-16be.php'); |
| 17 xhr2.onreadystatechange = function() { |
| 18 if (xhr2.readyState != xhr2.DONE) { return; } |
| 19 // A string with utf-16be BOM is decoded as utf-16be. |
| 20 shouldBeEqualToString('xhr2.responseText', |
| 21 '\u4e09\u6751\u304b\u306a\u5b50'); |
| 22 xhr3 = new XMLHttpRequest; |
| 23 xhr3.open('GET', 'resources/bom-utf-16le.php'); |
| 24 xhr3.onreadystatechange = function() { |
| 25 if (xhr3.readyState != xhr3.DONE) { return; } |
| 26 // A string with utf-16le BOM is decoded as utf-16le. |
| 27 shouldBeEqualToString('xhr3.responseText', |
| 28 '\u4e09\u6751\u304b\u306a\u5b50'); |
| 29 finishJSTest(); |
| 30 }; |
| 31 xhr3.send(); |
| 32 }; |
| 33 xhr2.send(); |
| 34 }; |
| 35 xhr.send(); |
| 36 </script> |
OLD | NEW |