I use the following java method. Might not completely address your requirement though.
<!-- language: lang-java -->
/**
* Returns if a character is one of Chinese-Japanese-Korean characters.
*
* @param c
* the character to be tested
* @return true if CJK, false otherwise
*/
private boolean isCharCJK(final char c) {
if ((Character.UnicodeBlock.of(c) == Character.UnicodeBlock.CJK_UNIFIED_IDEOGRAPHS)
|| (Character.UnicodeBlock.of(c) == Character.UnicodeBlock.CJK_UNIFIED_IDEOGRAPHS_EXTENSION_A)
|| (Character.UnicodeBlock.of(c) == Character.UnicodeBlock.CJK_UNIFIED_IDEOGRAPHS_EXTENSION_B)
|| (Character.UnicodeBlock.of(c) == Character.UnicodeBlock.CJK_COMPATIBILITY_FORMS)
|| (Character.UnicodeBlock.of(c) == Character.UnicodeBlock.CJK_COMPATIBILITY_IDEOGRAPHS)
|| (Character.UnicodeBlock.of(c) == Character.UnicodeBlock.CJK_RADICALS_SUPPLEMENT)
|| (Character.UnicodeBlock.of(c) == Character.UnicodeBlock.CJK_SYMBOLS_AND_PUNCTUATION)
|| (Character.UnicodeBlock.of(c) == Character.UnicodeBlock.ENCLOSED_CJK_LETTERS_AND_MONTHS)) {
return true;
}
return false;
}
Futhermore, these seem they should work for Hiragana and Katakana characters:
private boolean isHiragana(final char c)
{
return (Character.UnicodeBlock.of(c)==Character.UnicodeBlock.HIRAGANA);
}
private boolean isKatakana(final char c)
{
return (Character.UnicodeBlock.of(c)==Character.UnicodeBlock.KATAKANA);
}