Bug 454376 add -lCrun -lCstd for Solaris OS_LIBS, r=bsmedberg
[wine-gecko.git] / intl / uconv / tests / unit / test_bug367026.js
blobd892ecfcdc0c1a32303b1da6a2e076a0e85af57d
1 /* Tests conversion from Unicode to HZ-GB-2312 (bug 367026)
3 * Notes:
4 * HZ-GB-2312 is a 7-bit encoding of the GB2312 simplified Chinese character
5 * set. It uses the escape sequences "~{" to mark the start of GB encoded text
6 * and "~}" to mark the end.
8 * See http://www.ietf.org/rfc/rfc1843.txt
9 */
11 const inASCII = "Hello World";
12 const inHanzi = "\u4E00";
13 const inMixed = "Hello \u4E00 World";
15 const expectedASCII = "Hello World";
16 const expectedHanzi = "~{R;~}";
17 const expectedMixed = "Hello ~{R;~} World";
19 const charset = "HZ-GB-2312";
21 function run_test() {
22 var ScriptableUnicodeConverter =
23 Components.Constructor("@mozilla.org/intl/scriptableunicodeconverter",
24 "nsIScriptableUnicodeConverter");
26 var converter = new ScriptableUnicodeConverter();
27 converter.charset = charset;
29 var outASCII = converter.ConvertFromUnicode(inASCII) + converter.Finish();
30 do_check_eq(outASCII, expectedASCII);
32 var outMixed = converter.ConvertFromUnicode(inMixed) + converter.Finish();
33 do_check_eq(outMixed, expectedMixed);
35 var outHanzi = converter.ConvertFromUnicode(inHanzi) + converter.Finish();
36 do_check_eq(outHanzi, expectedHanzi);