diff --git a/icu4c/source/data/translit/Fullwidth_Halfwidth.txt b/icu4c/source/data/translit/Fullwidth_Halfwidth.txt index a74132b641..67b84f251a 100644 --- a/icu4c/source/data/translit/Fullwidth_Halfwidth.txt +++ b/icu4c/source/data/translit/Fullwidth_Halfwidth.txt @@ -253,9 +253,9 @@ ¥<>'¥'; # from FULLWIDTH YEN SIGN ₩<>₩; # from FULLWIDTH WON SIGN │<>│; # to HALFWIDTH FORMS LIGHT VERTICAL -'\u2190'<>'←'; # to HALFWIDTH LEFTWARDS ARROW +'←'<>'←'; # to HALFWIDTH LEFTWARDS ARROW ↑<>↑; # to HALFWIDTH UPWARDS ARROW -'\u2192'<>'→'; # to HALFWIDTH RIGHTWARDS ARROW +'→'<>'→'; # to HALFWIDTH RIGHTWARDS ARROW ↓<>↓; # to HALFWIDTH DOWNWARDS ARROW ■<>■; # to HALFWIDTH BLACK SQUARE ○<>○; # to HALFWIDTH WHITE CIRCLE diff --git a/icu4c/source/test/intltest/transtst.cpp b/icu4c/source/test/intltest/transtst.cpp index 0a1f7247c3..5ecc5a155d 100644 --- a/icu4c/source/test/intltest/transtst.cpp +++ b/icu4c/source/test/intltest/transtst.cpp @@ -188,6 +188,7 @@ TransliteratorTest::runIndexedTest(int32_t index, UBool exec, TESTCASE(79,TestBeginEndToRules); TESTCASE(80,TestRegisterAlias); TESTCASE(81,TestRuleStripping); + TESTCASE(82,TestHalfwidthFullwidth); default: name = ""; break; } } @@ -4466,6 +4467,53 @@ void TransliteratorTest::TestRuleStripping() { } } +/** + * Test the Halfwidth-Fullwidth transliterator (ticket 6281). + */ +void TransliteratorTest::TestHalfwidthFullwidth(void) { + UParseError parseError; + UErrorCode status = U_ZERO_ERROR; + Transliterator* hf = Transliterator::createInstance("Halfwidth-Fullwidth", UTRANS_FORWARD, parseError, status); + Transliterator* fh = Transliterator::createInstance("Fullwidth-Halfwidth", UTRANS_FORWARD, parseError, status); + if (hf == 0 || fh == 0) { + errln("FAIL: createInstance failed"); + delete hf; + delete fh; + return; + } + + // Array of 2n items + // Each item is + // "hf"|"fh"|"both", + // , + // + const char* DATA[] = { + "both", + "\\uFFE9\\uFFEA\\uFFEB\\uFFEC\\u0061\\uFF71\\u00AF\\u0020", + "\\u2190\\u2191\\u2192\\u2193\\uFF41\\u30A2\\uFFE3\\u3000", + }; + int32_t DATA_length = (int32_t)(sizeof(DATA) / sizeof(DATA[0])); + + for (int32_t i=0; i