我有一台热敏打印机,它只支持拉丁文以外的繁体中文字符。有没有办法检查给定Unicode中的CJK字符,它是否是Big-5编码下的有效繁体中文字符?
更新
这是我用来检查字符串是否具有 Unicode CJK 的方法。
public static boolean isChineseText(String s) {
for (int i = 0; s != null && s.length() > 0 && i < s.length(); i++) {
char ch = s.charAt(i);
Character.UnicodeBlock block = Character.UnicodeBlock.of(ch);
if (Character.UnicodeBlock.CJK_UNIFIED_IDEOGRAPHS.equals(block)
|| Character.UnicodeBlock.CJK_COMPATIBILITY_IDEOGRAPHS
.equals(block)
|| Character.UnicodeBlock.CJK_UNIFIED_IDEOGRAPHS_EXTENSION_A
.equals(block)) {
//Here, I want to check if its a Traditional Chinese character under Big-5
return true;
}
}
return false;
}