aboutsummaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2019-12-22 18:27:41 -0500
committertoasted-nutbread <toasted-nutbread@users.noreply.github.com>2020-01-24 20:15:25 -0500
commitb5015264f25af6b81d13dfee869ea34db4317aaa (patch)
tree6b628f4091c01cc279fa3e46cc4f2f84e8e84f64 /ext
parent86d96a903696db98c0680d7665c53da5cd80731f (diff)
Include half width and full width characters as Japanese characters
Diffstat (limited to 'ext')
-rw-r--r--ext/mixed/js/japanese.js16
1 files changed, 15 insertions, 1 deletions
diff --git a/ext/mixed/js/japanese.js b/ext/mixed/js/japanese.js
index 8d69c180..25f0608e 100644
--- a/ext/mixed/js/japanese.js
+++ b/ext/mixed/js/japanese.js
@@ -92,8 +92,22 @@ function jpIsKana(c) {
);
}
+function jpIsCharFullWidth(c) {
+ const code = c.charCodeAt(0);
+ return (
+ (code >= 0xff21 && code <= 0xff3a) || // full width upper case roman letters
+ (code >= 0xff41 && code <= 0xff3a) || // full width upper case roman letters
+ (code >= 0xff10 && code <= 0xff19) // full width numbers
+ );
+}
+
+function jpIsKanaHalfWidth(c) {
+ const code = c.charCodeAt(0);
+ return (code >= 0xff66 && code <= 0xff9f); // half width katakana
+}
+
function jpIsCharacterJapanese(c) {
- return jpIsKanji(c) || jpIsKana(c);
+ return jpIsKanji(c) || jpIsKana(c) || jpIsCharFullWidth(c) || jpIsKanaHalfWidth(c);
}
function jpIsAnyCharacterJapanese(text) {