michael@0: /* Tests transliteration of new characters in Unicode 5.1, 5.2, and 6.0 michael@0: */ michael@0: michael@0: const inTeluguFractions = "\u0C78\u0C79\u0C7A\u0C7B\u0C7C\u0C7D\u0C7E"; michael@0: const inMalayalamNumbers = "\u0D70\u0D71\u0D72\u0D73\u0D74\u0D75"; michael@0: michael@0: /* MYANMAR SHAN DIGIT ONE, michael@0: SUNDANESE DIGIT TWO, michael@0: LEPCHA DIGIT THREE, michael@0: OL CHIKI DIGIT FOUR, michael@0: VAI DIGIT FIVE, michael@0: SAURASHTRA DIGIT SIX michael@0: KAYAH LI DIGIT SEVEN michael@0: CHAM DIGIT EIGHT michael@0: JAVANESE DIGIT NINE michael@0: MEETEI MAYEK DIGIT ZERO */ michael@0: const inDigits = "\u1091\u1BB2\u1C43\u1C54\uA625\uA8D6\uA907\uAA58\uA9D9\uABF0"; michael@0: const inRomanNumerals = "\u2185\u2186\u2187\u2188"; michael@0: const inSuperSubscripts = "\u2C7C\u2C7D\u2095\u209C"; michael@0: michael@0: const expectedTeluguFractions = "[0][1][2][3][1][2][3]"; michael@0: const expectedMalayalamNumbers = "[10][100][1000][1/4][1/2][3/4]"; michael@0: const expectedDigits = "1234567890"; michael@0: const expectedRomanNumerals = "[6][50][50000][100000]"; michael@0: const expectedSuperSubscripts = "v(j)^(V)v(h)v(t)"; 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 outTeluguFractions = converter.Convert(inTeluguFractions); michael@0: do_check_eq(outTeluguFractions, expectedTeluguFractions); michael@0: michael@0: var outMalayalamNumbers = converter.Convert(inMalayalamNumbers); michael@0: do_check_eq(outMalayalamNumbers, expectedMalayalamNumbers); michael@0: michael@0: var outDigits = converter.Convert(inDigits); michael@0: do_check_eq(outDigits, expectedDigits); michael@0: michael@0: var outRomanNumerals = converter.Convert(inRomanNumerals); michael@0: do_check_eq(outRomanNumerals, expectedRomanNumerals); michael@0: michael@0: var outSuperSubscripts = converter.Convert(inSuperSubscripts); michael@0: do_check_eq(outSuperSubscripts, expectedSuperSubscripts); michael@0: }