4 ms·
Does something like this exist for Javascript? In particular I am looking for a function that tests whether a character is CJK or not.
by miketuritzin 12y ago
Does something like this exist for Javascript? In particular I am looking for a function that tests whether a character is CJK or not.
- nness 12y agoCJK 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/ https://mths.be/regenerate/.
- sanxiyn 12y ago3400-4DBF is CJK Unified Ideographs Extension A. The main block is 4E00-9FFF CJK Unified Ideographs. See http://en.wikipedia.org/wiki/Unicode_block http://en.wikipedia.org/wiki/Unicode_block