How do I detect multibyte characters entering the end of javascript?

I am currently listening to "Enter" to start sending a message,

But for multibyte characters, the "Enter" key must select a specific character.

The problem is I don't know how to determine if the user is in the middle of the input

a multibyte character, and even if it is in this process, the message will be sent first

time he presses the "Enter" key.

So the UI is really weird.

Anyone have a solution to this?

If you don't understand what I mean above, you can try chatting here,

and once you start a conversation, switch to multibyte mode,

then you will understand what I mean.

link here:

http://maishudi.com/OMegle.php

0


a source to share


1 answer


I am assuming your multibyte input reference is a reference to Input Methods (or Input Method Editors in windows).

Unfortunately, at the moment there is no real solution - DOM3 was going to add mechanisms for this, but it seems to have diminished due to the complexity.

Some of the complexity comes from the completely different behavior of the individual input methods before you even consider the behavior mismatch between browsers. A good example is to just check what key events you get for a set of actions with Japanese, Korean and (Traditional and Simplified) Chinese. Browsers cannot avoid this as they react to events fired directly by the input editors.



The only things you can rely on are keyDown events, and even then there isn't much in opera and firefox. Safari and IE provide KeyDown events during IME composition, with charCode 229, and a keyUp event with charCode corresponding to the actual key pressed.

There is a textInput event, but this is only supported by Safari (and by proxy, Chrome should support it too), but it's not much better than the standard events: - /

0


a source







All Articles