diff options
author | Yutaro Ogasawara <yutaro.ogasawara@gmail.com> | 2011-11-23 11:14:21 +0900 |
---|---|---|
committer | Yutaro Ogasawara <yutaro.ogasawara@gmail.com> | 2011-12-18 04:11:00 +0900 |
commit | ae72de98e9963b7a7b19eae963820a8e680b8e64 (patch) | |
tree | 3b2635c50c6559afb5b89c64fa19d8215174a235 /android/PhonebookIndex.cpp | |
parent | be70c03d9ba1bb98b8840517eb3bed845c1272ff (diff) |
GetPhonebookIndex: Fix handling for minor Japanese kana characters
This adds minor Japanese kana character handling to meet the
unicode collation algorithm.
-Normalize digraphs (yori, koto) into first reading letter.
-Treat dakuten, dot, onbiki, iteration marks as a symbol.
-Add handling for minor small katakana letter.
Signed-off-by: Yutaro Ogasawara <yutaro.ogasawara@gmail.com>
Diffstat (limited to 'android/PhonebookIndex.cpp')
-rw-r--r-- | android/PhonebookIndex.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/android/PhonebookIndex.cpp b/android/PhonebookIndex.cpp index 8f5e4be..5cc26e5 100644 --- a/android/PhonebookIndex.cpp +++ b/android/PhonebookIndex.cpp @@ -169,19 +169,23 @@ int32_t GetPhonebookIndex(UCharIterator * iter, const char * locale, UChar * out c = android::GetNormalizedCodePoint(c, next, NULL); // Traditional grouping of Hiragana characters - if (0x3042 <= c && c <= 0x309F) { + if (0x3041 <= c && c <= 0x309F) { if (c < 0x304B) c = 0x3042; // a else if (c < 0x3055) c = 0x304B; // ka else if (c < 0x305F) c = 0x3055; // sa else if (c < 0x306A) c = 0x305F; // ta else if (c < 0x306F) c = 0x306A; // na else if (c < 0x307E) c = 0x306F; // ha - else if (c < 0x3084) c = 0x307E; // ma + else if (c < 0x3083) c = 0x307E; // ma else if (c < 0x3089) c = 0x3084; // ya - else if (c < 0x308F) c = 0x3089; // ra - else c = 0x308F; // wa + else if (c < 0x308E) c = 0x3089; // ra + else if (c < 0x3094) c = 0x308F; // wa + else return 0; // Others are not readable out[0] = c; return 1; + } else if (0x30A0 <= c && c <= 0x30FF) { + // Dot, onbiki, iteration marks are not readable + return 0; } if (is_CJK(c)) { |