From b5015264f25af6b81d13dfee869ea34db4317aaa Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Sun, 22 Dec 2019 18:27:41 -0500 Subject: Include half width and full width characters as Japanese characters --- ext/mixed/js/japanese.js | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'ext') 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) { -- cgit v1.2.3