I'm trying to catch the character inserted before it shows on the screen to validate the screen. See my code
_this.on('keypress keydown',function(e){
var t = e.target;
var k = e.which || e.keyCode;
var c = String.fromCharCode(k);
console.log(String.fromCharCode(k))
});
If I for example type ~
or any other punctuation characters, it returns non-latin characters, such as å
. I'm on Chromium, Ubuntu.
I noticed that the keypress is being ignored with these special characters, what is a shame and that's why I am trying with keydown as well. But keydown fails to detect the right character and converts them to scandinavian and asian characters.
Is there a workaround to get the correct character being yped?