diff --git a/src/strconv/quote.go b/src/strconv/quote.go index b50496a0ff..bcbdbc514d 100644 --- a/src/strconv/quote.go +++ b/src/strconv/quote.go @@ -145,8 +145,9 @@ func AppendQuoteToASCII(dst []byte, s string) []byte { } // QuoteToGraphic returns a double-quoted Go string literal representing s. -// The returned string uses Go escape sequences (\t, \n, \xFF, \u0100) for -// non-ASCII characters and non-printable characters as defined by IsGraphic. +// The returned string leaves Unicode graphic characters, as defined by +// IsGraphic, unchanged and uses Go escape sequences (\t, \n, \xFF, \u0100) +// for non-graphic characters. func QuoteToGraphic(s string) string { return quoteWith(s, '"', false, true) } @@ -185,9 +186,9 @@ func AppendQuoteRuneToASCII(dst []byte, r rune) []byte { } // QuoteRuneToGraphic returns a single-quoted Go character literal representing -// the rune. The returned string uses Go escape sequences (\t, \n, \xFF, -// \u0100) for non-ASCII characters and non-printable characters as defined -// by IsGraphic. +// the rune. If the rune is not a Unicode graphic character, +// as defined by IsGraphic, the returned string will use a Go escape sequence +// (\t, \n, \xFF, \u0100). func QuoteRuneToGraphic(r rune) string { return quoteRuneWith(r, '\'', false, true) }