1
0
mirror of https://github.com/golang/go synced 2024-11-18 22:55:23 -07:00

encoding/json: adjust comment about encoding \b and \f

The encoding for the control characters \b and \f was
changed in http://go.dev/cl/521675. This CL adjusts the
corresponding comment about encoding bytes < 0x20.

Change-Id: I83b7311e4fa0731f6601ca64a66042425b4cecac
Reviewed-on: https://go-review.googlesource.com/c/go/+/523435
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Joseph Tsai <joetsai@digital-static.net>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Joseph Tsai <joetsai@digital-static.net>
This commit is contained in:
Christian Höppner 2023-08-28 15:12:08 +02:00
parent e9c14a7780
commit 3db23523b8

View File

@ -980,7 +980,7 @@ func appendString[Bytes []byte | string](dst []byte, src Bytes, escapeHTML bool)
case '\t':
dst = append(dst, '\\', 't')
default:
// This encodes bytes < 0x20 except for \t, \n and \r.
// This encodes bytes < 0x20 except for \b, \f, \n, \r and \t.
// If escapeHTML is set, it also escapes <, >, and &
// because they can lead to security holes when
// user-controlled strings are rendered into JSON