mirror of
https://github.com/gin-gonic/gin.git
synced 2026-07-14 23:21:18 +08:00
Compare commits
1 Commits
fafbebb7ec
...
f73b822886
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f73b822886 |
@ -9,7 +9,6 @@ import (
|
||||
"fmt"
|
||||
"html/template"
|
||||
"net/http"
|
||||
"unicode"
|
||||
|
||||
"github.com/gin-gonic/gin/internal/bytesconv"
|
||||
"github.com/gin-gonic/gin/internal/json"
|
||||
@ -163,7 +162,7 @@ func (r AsciiJSON) Render(w http.ResponseWriter) error {
|
||||
escapeBuf := make([]byte, 0, 6) // Preallocate 6 bytes for Unicode escape sequences
|
||||
|
||||
for _, r := range bytesconv.BytesToString(ret) {
|
||||
if r > unicode.MaxASCII {
|
||||
if r >= 128 {
|
||||
escapeBuf = fmt.Appendf(escapeBuf[:0], "\\u%04x", r) // Reuse escapeBuf
|
||||
buffer.Write(escapeBuf)
|
||||
} else {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user