Encode \b and \f in JSON string as themselves

This commit is contained in:
Kai A. Hiller 2024-02-14 21:14:05 +01:00
parent 6ee9f877d6
commit b622071bec
1 changed files with 4 additions and 0 deletions

View File

@ -1926,6 +1926,10 @@ func AppendJSONString(dst []byte, s string) []byte {
if s[i] < ' ' {
dst = append(dst, '\\')
switch s[i] {
case '\b':
dst = append(dst, 'b')
case '\f':
dst = append(dst, 'f')
case '\n':
dst = append(dst, 'n')
case '\r':