mirror of
https://github.com/gin-gonic/gin.git
synced 2026-11-23 11:33:37 +08:00
AsciiJSON escaped every non-ASCII rune with \u%04x, but %04x is a minimum width — for code points above U+FFFF it produced 5+ hex digits, creating a malformed \uXXXXX escape. JSON \u escapes must be exactly 4 hex digits; non-BMP characters must be encoded as UTF-16 surrogate pairs per RFC 8259 §7. For example, U+1F600 (😀) was emitted as \u1f600 (which decodes to U+1F60 + literal '0') instead of \ud83d\ude00. Fixes #4688