| <html> |
| <head> |
| <script src="../../resources/js-test-pre.js"></script> |
| <script src="resources/char-encoding-utils.js"></script> |
| </head> |
| <body> |
| <form id="form" method="GET" target="subframe"><input type="text" id="text" name="text"></form> |
| <iframe id="subframe" name="subframe"></iframe> |
| <script> |
| |
| |
| var charsets = new Array; |
| var unicodes = new Array; |
| var expectedResults = new Array; |
| |
| var results = new Object; |
| |
| var i = 0; |
| |
| testEncode("UTF-8", "U+00A0", "%C2%A0"); |
| //Yen symbol in gbk |
| testEncode('GBK', 'U+00A5', '%26%23165%3B'); |
| testEncode('gb2312', 'U+00A5', '%26%23165%3B'); |
| testEncode('GB_2312-80', 'U+00A5', '%26%23165%3B'); |
| testEncode('EUC-CN', 'U+00A5', '%26%23165%3B'); |
| //Euro symbol in gbk |
| testEncode('GBK', 'U+20AC', '%80'); |
| testEncode('gb2312', 'U+20AC', '%80'); |
| testEncode('GB_2312-80', 'U+20AC', '%80'); |
| testEncode('EUC-CN', 'U+20AC', '%80'); |
| //Misc symbols from TEC specific GBK translation |
| testEncode('GBK', 'U+01F9', '%A8%BF'); |
| testEncode('GBK', 'U+1E3F', '%A8%BC'); |
| testEncode('GBK', 'U+22EF', '%26%238943%3B'); |
| testEncode('GBK', 'U+301C', '%26%2312316%3B'); |
| // Replacement encodings - should encode as UTF-8 |
| testEncode("csiso2022kr", "U+00A0", "%C2%A0"); |
| testEncode("hz-gb-2312", "U+00A0", "%C2%A0"); |
| testEncode("iso-2022-cn", "U+00A0", "%C2%A0"); |
| testEncode("iso-2022-cn-ext", "U+00A0", "%C2%A0"); |
| testEncode("iso-2022-kr", "U+00A0", "%C2%A0"); |
| |
| // Turning on this test causes a download to occur. FIXME: A bug? |
| // testEncode('UTF-8', 'U+221A', '%E2%88%9A'); |
| |
| if (window.testRunner) |
| testRunner.waitUntilDone(); |
| runTest(); |
| |
| </script> |
| </body> |
| </html> |