summaryrefslogtreecommitdiff
path: root/internal
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@lukeshu.com>2023-02-16 17:20:41 -0700
committerLuke Shumaker <lukeshu@lukeshu.com>2023-02-18 22:45:54 -0700
commit2eb60b8be25a4b0fe3f1c5d5ca302e7e68190bad (patch)
tree0a4001f1e37d8e3a29fa3f569fa7f850c0d9f766 /internal
parent1a5b0561f53441d8a259a5096281699b5af16a6c (diff)
compat/json: Don't do actual JSON parsing in HTMLEscape
Diffstat (limited to 'internal')
-rw-r--r--internal/jsonstring/encode_string.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/internal/jsonstring/encode_string.go b/internal/jsonstring/encode_string.go
index 76bbb38..2488cb2 100644
--- a/internal/jsonstring/encode_string.go
+++ b/internal/jsonstring/encode_string.go
@@ -38,7 +38,7 @@ const (
// BackslashEscaper is describe in the main lowmemjson package docs.
type BackslashEscaper = func(rune, BackslashEscapeMode) BackslashEscapeMode
-func writeStringUnicodeEscape(w io.Writer, c rune) error {
+func WriteStringUnicodeEscape(w io.Writer, c rune) error {
const alphabet = "0123456789abcdef"
buf := [6]byte{
'\\',
@@ -84,7 +84,7 @@ func WriteStringChar(w fastio.AllWriter, c rune, escape BackslashEscapeMode) err
case '\b', '\f', '\n', '\r', '\t': // short-escape if possible
return writeStringShortEscape(w, c)
default:
- return writeStringUnicodeEscape(w, c)
+ return WriteStringUnicodeEscape(w, c)
}
case c == '"' || c == '\\': // override, gotta escape these
return writeStringShortEscape(w, c)
@@ -106,7 +106,7 @@ func WriteStringChar(w fastio.AllWriter, c rune, escape BackslashEscapeMode) err
_, err := w.WriteRune(c)
return err
default: // obey
- return writeStringUnicodeEscape(w, c)
+ return WriteStringUnicodeEscape(w, c)
}
case BackslashEscapeRawByte:
switch {