5 comments

[ 4.4 ms ] story [ 24.6 ms ] thread
Does something like this exist for Javascript? In particular I am looking for a function that tests whether a character is CJK or not.
CJK characters are stored in the range 3400–4DBF and 3400-4DB5 (could be others, but those are what Google comes up with first).

You can use JavaScript regular expressions to check for Unicode ranges. The challenge is that Unicode uses UCS-2 internally, and EMCAScript 5 doesn't handle surrogate pairs.

Thankfully, there's https://mths.be/regenerate/.

Looks like this is a nice abstraction of Python's Unicode Database, "unicodedata."
Yup. It does all of the stuff I had trouble finding and figuring out by myself. I'm sure more annoying corner cases will come up later on (as they always do with alphabets and unicode), and I'll keep adding to it.