summaryrefslogtreecommitdiff
path: root/internal/jsonstring/encode_string.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/jsonstring/encode_string.go')
-rw-r--r--internal/jsonstring/encode_string.go10
1 files changed, 5 insertions, 5 deletions
diff --git a/internal/jsonstring/encode_string.go b/internal/jsonstring/encode_string.go
index f29dc3f..a7670c6 100644
--- a/internal/jsonstring/encode_string.go
+++ b/internal/jsonstring/encode_string.go
@@ -10,7 +10,6 @@ import (
"unicode/utf8"
"git.lukeshu.com/go/lowmemjson/internal/fastio"
- "git.lukeshu.com/go/lowmemjson/internal/jsonparse"
)
// BackslashEscapeMode is describe in the main lowmemjson package
@@ -27,13 +26,14 @@ const (
type BackslashEscaper = func(rune, BackslashEscapeMode) BackslashEscapeMode
func writeStringUnicodeEscape(w io.Writer, c rune) (int, error) {
+ const alphabet = "0123456789abcdef"
buf := [6]byte{
'\\',
'u',
- jsonparse.Hex[(c>>12)&0xf],
- jsonparse.Hex[(c>>8)&0xf],
- jsonparse.Hex[(c>>4)&0xf],
- jsonparse.Hex[(c>>0)&0xf],
+ alphabet[(c>>12)&0xf],
+ alphabet[(c>>8)&0xf],
+ alphabet[(c>>4)&0xf],
+ alphabet[(c>>0)&0xf],
}
return w.Write(buf[:])
}