michael@0: /* Tests conversion from Unicode to HZ-GB-2312 (bug 367026) michael@0: * michael@0: * Notes: michael@0: * HZ-GB-2312 is a 7-bit encoding of the GB2312 simplified Chinese character michael@0: * set. It uses the escape sequences "~{" to mark the start of GB encoded text michael@0: * and "~}" to mark the end. michael@0: * michael@0: * See http://www.ietf.org/rfc/rfc1843.txt michael@0: */ michael@0: michael@0: load('CharsetConversionTests.js'); michael@0: michael@0: const inASCII = "Hello World"; michael@0: const inHanzi = "\u4E00"; michael@0: const inMixed = "Hello \u4E00 World"; michael@0: michael@0: const expectedASCII = "Hello World"; michael@0: const expectedHanzi = "~{R;~}"; michael@0: const expectedMixed = "Hello ~{R;~} World"; michael@0: michael@0: const charset = "HZ-GB-2312"; michael@0: michael@0: function run_test() { michael@0: var converter = CreateScriptableConverter(); michael@0: michael@0: checkEncode(converter, charset, inASCII, expectedASCII); michael@0: checkEncode(converter, charset, inMixed, expectedMixed); michael@0: checkEncode(converter, charset, inHanzi, expectedHanzi); michael@0: }