I am working with Yiddish, for which some letters consist of two Unicode characters. For example, אַ consists of U+05D0
+ U+05B7
. There are single code variants of these characters (eg. U+FB2E
for אַ), but most keyboards take the former approach.
I'd like to capture input from a Yiddish keyboard using keydown
, but I'm having trouble with these keys that output multiple Unicode characters. In particular, I'm using a simple code:
$(document).keydown(function (event) {
if (!event.metaKey) {
console.log(event.key);
}
});
See it on JSFiddle.
I'm on Windows, and on Firefox, I'm getting the expected result when I press אַ (which is the letter A on my keyboard, and outputs U+05D0
U+05B7
): namely, the console logs אַ. However, on Chrome (version 98), I get "Unidentified" as the output (although I get the expected result for any key that outputs a single Unicode character). The same thing happens on Edge. I don't have a Mac, but a friend tested for me and weirder things happened: it logged the U+05B7
but not the U+05D0
. Safari worked fine for him, though.
Any idea what's going on, and how to fix it?
from JavaScript keydown in Chrome not capturing a single keypress that outputs multiple Unicode characters
No comments:
Post a Comment