]> Cypherpunks repositories - gostls13.git/commitdiff
strconv: stop describing Unicode graphic characters as non-ASCII
authorIan Lance Taylor <iant@golang.org>
Sun, 26 Jan 2020 16:12:58 +0000 (08:12 -0800)
committerIan Lance Taylor <iant@golang.org>
Sun, 26 Jan 2020 20:38:34 +0000 (20:38 +0000)
Fixes #36778

Change-Id: I3c4ce100fc219bda0ff1d7a086c2309ed695691d
Reviewed-on: https://go-review.googlesource.com/c/go/+/216478
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
src/strconv/quote.go

index b50496a0ffbbc3098ed3331dcb849b1f971952dd..bcbdbc514d21a8b72f8f83fecd5cc8cb5b9d4c49 100644 (file)
@@ -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)
 }