diff options
-rw-r--r-- | src/strconv/quote.go | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/src/strconv/quote.go b/src/strconv/quote.go index 1b5bddfeae..7c38433679 100644 --- a/src/strconv/quote.go +++ b/src/strconv/quote.go @@ -66,7 +66,6 @@ func appendQuotedRuneWith(buf []byte, r rune, quote byte, ASCIIonly, graphicOnly } func appendEscapedRune(buf []byte, r rune, quote byte, ASCIIonly, graphicOnly bool) []byte { - var runeTmp [utf8.UTFMax]byte if r == rune(quote) || r == '\\' { // always backslashed buf = append(buf, '\\') buf = append(buf, byte(r)) @@ -78,9 +77,7 @@ func appendEscapedRune(buf []byte, r rune, quote byte, ASCIIonly, graphicOnly bo return buf } } else if IsPrint(r) || graphicOnly && isInGraphicList(r) { - n := utf8.EncodeRune(runeTmp[:], r) - buf = append(buf, runeTmp[:n]...) - return buf + return utf8.AppendRune(buf, r) } switch r { case '\a': @@ -471,9 +468,7 @@ func unquote(in string, unescape bool) (out, rem string, err error) { if r < utf8.RuneSelf || !multibyte { buf = append(buf, byte(r)) } else { - var arr [utf8.UTFMax]byte - n := utf8.EncodeRune(arr[:], r) - buf = append(buf, arr[:n]...) + buf = utf8.AppendRune(buf, r) } } |