aboutsummaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2020-01-24 17:53:14 -0500
committertoasted-nutbread <toasted-nutbread@users.noreply.github.com>2020-01-24 20:15:25 -0500
commit46e3d72641bee767f5d54e8778597549df85bdb3 (patch)
tree38967f9a0220eb59208e127f4341f229be9d3fc9 /ext
parent0c3b7d0fbcab11c8f2602d3874f4d3c8b313f06b (diff)
Move where 'a' character offset is applied
Diffstat (limited to 'ext')
-rw-r--r--ext/mixed/js/japanese.js15
1 files changed, 8 insertions, 7 deletions
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) {