|
|
@ -257,13 +257,18 @@ public final class QrSegmentAdvanced {
|
|
|
|
public static boolean isEncodableAsKanji(String text) {
|
|
|
|
public static boolean isEncodableAsKanji(String text) {
|
|
|
|
Objects.requireNonNull(text);
|
|
|
|
Objects.requireNonNull(text);
|
|
|
|
for (int i = 0; i < text.length(); i++) {
|
|
|
|
for (int i = 0; i < text.length(); i++) {
|
|
|
|
if (UNICODE_TO_QR_KANJI[text.charAt(i)] == -1)
|
|
|
|
if (!isKanji(text.charAt(i)))
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static boolean isKanji(char c) {
|
|
|
|
|
|
|
|
return UNICODE_TO_QR_KANJI[c] != -1;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Data derived from ftp://ftp.unicode.org/Public/MAPPINGS/OBSOLETE/EASTASIA/JIS/SHIFTJIS.TXT
|
|
|
|
// Data derived from ftp://ftp.unicode.org/Public/MAPPINGS/OBSOLETE/EASTASIA/JIS/SHIFTJIS.TXT
|
|
|
|
private static final String PACKED_QR_KANJI_TO_UNICODE =
|
|
|
|
private static final String PACKED_QR_KANJI_TO_UNICODE =
|
|
|
|
"MAAwATAC/wz/DjD7/xr/G/8f/wEwmzCcALT/QACo/z7/4/8/MP0w/jCdMJ4wA07dMAUwBjAHMPwgFSAQ/w8AXDAcIBb/XCAmICUgGCAZIBwgHf8I/wkwFDAV/zv/Pf9b/10wCDAJMAowCzAMMA0wDjAPMBAwEf8LIhIAsQDX//8A9/8dImD/HP8eImYiZyIeIjQmQiZA" +
|
|
|
|
"MAAwATAC/wz/DjD7/xr/G/8f/wEwmzCcALT/QACo/z7/4/8/MP0w/jCdMJ4wA07dMAUwBjAHMPwgFSAQ/w8AXDAcIBb/XCAmICUgGCAZIBwgHf8I/wkwFDAV/zv/Pf9b/10wCDAJMAowCzAMMA0wDjAPMBAwEf8LIhIAsQDX//8A9/8dImD/HP8eImYiZyIeIjQmQiZA" +
|
|
|
|