michael@0: /* Tests conversion of unrepresented characters that should be transliterated michael@0: * to spaces (bug 365345), and some others from transliterate.properties while michael@0: * I'm here michael@0: */ michael@0: michael@0: const inSpace = "Hello Space"; michael@0: const inEnSpace = "Hello\u2002EnSpace"; michael@0: const inEmSpace = "Hello\u2003EmSpace"; michael@0: const inEuro = "Hello\u20ACEuro"; michael@0: const inTamil1000 = "Hello\u0BF2Tamil1000"; michael@0: const inMonospace9 = "Hello\ud835\udfffMonospace9"; michael@0: michael@0: const expectedSpace = "Hello Space"; michael@0: const expectedEnSpace = "Hello EnSpace"; michael@0: const expectedEmSpace = "Hello EmSpace"; michael@0: const expectedEuro = "HelloEUREuro"; michael@0: const expectedTamil1000 = "Hello[1000]Tamil1000"; michael@0: const expectedMonospace9 = "Hello9Monospace9"; michael@0: michael@0: const EntityAfterCharsetConv = 512; michael@0: const transliterate = 8; michael@0: michael@0: const charset = "ISO-8859-1"; michael@0: michael@0: function run_test() { michael@0: var SaveAsCharset = michael@0: Components.Constructor("@mozilla.org/intl/saveascharset;1", michael@0: "nsISaveAsCharset", michael@0: "Init"); michael@0: michael@0: var converter = new SaveAsCharset(charset, michael@0: EntityAfterCharsetConv, michael@0: transliterate); michael@0: michael@0: var outSpace = converter.Convert(inSpace); michael@0: do_check_eq(outSpace, expectedSpace); michael@0: michael@0: var outEnSpace = converter.Convert(inEnSpace); michael@0: do_check_eq(outEnSpace, expectedEnSpace); michael@0: michael@0: var outEmSpace = converter.Convert(inEmSpace); michael@0: do_check_eq(outEmSpace, expectedEmSpace); michael@0: michael@0: var outEuro = converter.Convert(inEuro); michael@0: do_check_eq(outEuro, expectedEuro); michael@0: michael@0: var outTamil1000 = converter.Convert(inTamil1000); michael@0: do_check_eq(outTamil1000, expectedTamil1000); michael@0: michael@0: var outMonospace9 = converter.Convert(inMonospace9); michael@0: do_check_eq(outMonospace9, expectedMonospace9); michael@0: }