From 46e3d72641bee767f5d54e8778597549df85bdb3 Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Fri, 24 Jan 2020 17:53:14 -0500 Subject: Move where 'a' character offset is applied --- ext/mixed/js/japanese.js | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'ext/mixed/js/japanese.js') diff --git a/ext/mixed/js/japanese.js b/ext/mixed/js/japanese.js index 93366db0..d299dfe9 100644 --- a/ext/mixed/js/japanese.js +++ b/ext/mixed/js/japanese.js @@ -375,15 +375,16 @@ function jpConvertAlphabeticToKana(text, sourceMapping) { } for (let i = 0; i < ii; ++i) { + // Note: 0x61 is the character code for 'a' let c = text.charCodeAt(i); if (c >= 0x41 && c <= 0x5a) { // ['A', 'Z'] - c -= 0x41; + c += (0x61 - 0x41); } else if (c >= 0x61 && c <= 0x7a) { // ['a', 'z'] - c -= 0x61; - } else if (c >= 0xff21 && c <= 0xff3a) { // ['A', 'Z'] full width - c -= 0xff21; - } else if (c >= 0xff41 && c <= 0xff5a) { // ['a', 'z'] full width - c -= 0xff41; + // NOP; c += (0x61 - 0x61); + } else if (c >= 0xff21 && c <= 0xff3a) { // ['A', 'Z'] fullwidth + c += (0x61 - 0xff21); + } else if (c >= 0xff41 && c <= 0xff5a) { // ['a', 'z'] fullwidth + c += (0x61 - 0xff41); } else { if (part.length > 0) { result += jpToHiragana(part, sourceMapping, result.length); @@ -392,7 +393,7 @@ function jpConvertAlphabeticToKana(text, sourceMapping) { result += text[i]; continue; } - part += String.fromCharCode(c + 0x61); // + 'a' + part += String.fromCharCode(c); } if (part.length > 0) { -- cgit v1.2.3