(Information from Barry Yip <g609296@cc.win.or.jp
>,
Norman Diamond, NIIBE Yutaka and H. Peter Anvin, who
contributed the photographs of his
JP106 keyboard above and of his Japanese laptop.)
Common Japanese keyboards have five additional keys (106-key, or 86-key for a notebook; these days there may also be 3 extra Windows keys). These keys have scancodes 70 (hiragana/katakana), 73 (backslash/underscore), 79 (henkan/zenkouho), 7b (muhenkan), 7d (yen/vertical bar).
USB | Scancode | Japanese | US | USB | Scancode | Japanese | US | |
53 | 29 | (hankaku/zenkaku) | (` / ~) | 47 | 1a | (@ / `) | ([ / {) | |
31 | 03 | (2 / ") | (2 / @) | 48 | 1b | ([ / {) | (] / }) | |
35 | 07 | (6 / &) | (6 / ^) | 51 | 27 | (; / +) | (; / :) | |
36 | 08 | (7 / ') | (7 / &) | 52 | 28 | (: / *) | (' / ") | |
37 | 09 | (8 / () | (8 / *) | 29 | 2b | (] / }) | (backslash / |) | |
38 | 0a | (9 / )) | (9 / () | 135 | 73 | (backslash / _) | ||
39 | 0b | (0 / ~) | (0 / )) | 139 | 7b | (muhenkan) | ||
45 | 0c | (- / =) | (- / _) | 138 | 79 | (henkan/zenkouho) | ||
46 | 0d | (^ / overbar) | (= / +) | 136 | 70 | (hiragana/katakana) | ||
137 | 7d | (\ / |) | ||||||
ASCII and JIS-Roman differ in two or three points: the code positions where ASCII has backslash, tilde, broken bar, JIS-Roman uses yen, overbar and vertical bar, respectively.
Some keyboards have the tilde printed on the keycap for the 0 key, some don't. Similarly, some keyboards have the backslash printed on the keycap for the _ key and some don't, but in all cases you need Shift to get _.
Norman Diamond adds to the previous section:
To the left of the spacebar, (Shift-JIS) 無変換(muhenkan) means no conversion from kana to kanji. To the right of the spacebar, 変換 (henkan) means conversion from kana to kanji. In Microsoft systems it converts the most recently input sequence of kana to the system's first guess at a string of kanji/kana/etc. with the correct pronunciation and a guess at the meaning. Repeated keypresses change it to other possible guesses which are either less common or less recently used, depending on the situation. The shifted version of this key is 前侯補 (zenkouho) which means "previous candidate" -- "zen" means "previous", while "kouho" means "candidate" (explanation courtesy of NIIBE Yutaka) -- it rotates back to earlier guesses for kanji conversion. The alt version of this key is 全侯補 also pronounced (zenkouho), which means "all candidates" -- here, "zen" means "all" -- it displays a menu of all known guesses. I never use the latter two functions of the key, because after pushing the henkan key about three times and not getting the desired guess, it displays a menu of all known guesses anyway.
Next on the right, ひらがな (hiragana) means that phonetic input uses one conventional Japanese phonetic alphabet, which of course can be converted to kanji by pressing the henkan key later. The shifted version is カタカナ (katakana) which means the other Japanese phonetic alphabet, and the alt version is ローマ字 (ro-maji) which means the Roman alphabet.
Near the upper left, 半/全 (han/zen) means switch between hankaku (half-size, the same size as an ASCII character) and zenkaku (full-size, since the amount of space occupied by a kanji is approximately a square, twice as fat as an ASCII character). It only affects katakana and a few other characters (for example there's a full-width copy of each ASCII character in addition to the single-byte half-width encodings). The alt version of this is 漢字 (kanji) which actually causes typed Roman phonetic keys to be displayed as Japanese phonetic kana (either hiragana or katakana depending on one of the other keys described above) and doesn't cause conversion to kanji.
John Bradford reports that he has a Japanese keyboard (an IBM 5576 KEYBOARD-2, part number 94X1110) that by default simulates US key layout. Thus, pressing the @ key yields scancodes 2a 03 (fake shift followed by digit 2), pressing Shift - yields scancodes b6 0d (fake shift down, =) with release 8d 36, etc.
Thus, the (translated Set 2) scancodes can be read off the table with differences between the Japanese and the US layout.
In this state the non-ASCII keys (Yen and overline) yield an error (ff). The Japanese keys hankaku, kanji/katakana, muhenkan, zenkoho/henkan, hiragana, zenmen ki, yield the codes expected from keys in that position on a US keyboard: 29 (`/~), 38 (LAlt), 39 (space), 39 (space), 39 (space), e0 38 (RAlt), respectively.
Switching the keyboard to Set 3 enables the Japanese keys. In untranslated Set 3 these give codes: hankaku 0e, Yen 13, overline (shift ^), kanji/katakana 19, muhenkan 85, zenkoho/henkan 86, hiragana 87, zenmen ki 39. (Also: backslash/underscore 5c, bracketright/braceright 53.)
This is the only keyboard I know that gives more information in Set 3 than in Set 2. It reports keyboard ID ab 90.