mirror of
https://github.com/gin-gonic/gin.git
synced 2026-06-16 12:10:44 +08:00
The AsciiJSON Render method used fmt.Appendf(buf, "\u%04x", r) for all
non-ASCII runes. For non-BMP characters (code points > 0xFFFF, e.g. emoji),
this produced invalid JSON with raw 5+ hex digit sequences like \u1f389.
Fix: use utf16.Encode([]rune{r}) to convert non-BMP runes into UTF-16
surrogate pairs, producing valid JSON like \ud83c\udf89.
Fixes #4688
Signed-off-by: Md Mushfiqur Rahim <20mahin2020@gmail.com>