Hacker News new | ask | show | jobs
by gengkev 3522 days ago
I'm a bit confused that TJSON only allows UTF-8 strings. The only way to escape Unicode characters in JSON is \uXXXX. But to encode astral characters with this syntax, UTF-16 surrogate pairs must be used. How does TJSON handle this, if strings must be encoded with UTF-8 only?
1 comments

JSON is defined to use surrogate pairs to encode these. TJSON must do nothing here.

e.g. \ud8a4\uddd1 => U+391d1