1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/intl/uconv/tests/unit/test_bug367026.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,29 @@ 1.4 +/* Tests conversion from Unicode to HZ-GB-2312 (bug 367026) 1.5 + * 1.6 + * Notes: 1.7 + * HZ-GB-2312 is a 7-bit encoding of the GB2312 simplified Chinese character 1.8 + * set. It uses the escape sequences "~{" to mark the start of GB encoded text 1.9 + * and "~}" to mark the end. 1.10 + * 1.11 + * See http://www.ietf.org/rfc/rfc1843.txt 1.12 + */ 1.13 + 1.14 +load('CharsetConversionTests.js'); 1.15 + 1.16 +const inASCII = "Hello World"; 1.17 +const inHanzi = "\u4E00"; 1.18 +const inMixed = "Hello \u4E00 World"; 1.19 + 1.20 +const expectedASCII = "Hello World"; 1.21 +const expectedHanzi = "~{R;~}"; 1.22 +const expectedMixed = "Hello ~{R;~} World"; 1.23 + 1.24 +const charset = "HZ-GB-2312"; 1.25 + 1.26 +function run_test() { 1.27 + var converter = CreateScriptableConverter(); 1.28 + 1.29 + checkEncode(converter, charset, inASCII, expectedASCII); 1.30 + checkEncode(converter, charset, inMixed, expectedMixed); 1.31 + checkEncode(converter, charset, inHanzi, expectedHanzi); 1.32 +}