@@ -165,6 +165,8 @@ func AppendQuoteToGraphic(dst []byte, s string) []byte {
165
165
// QuoteRune returns a single-quoted Go character literal representing the
166
166
// rune. The returned string uses Go escape sequences (\t, \n, \xFF, \u0100)
167
167
// for control characters and non-printable characters as defined by IsPrint.
168
+ // If r is not a valid Unicode code point, it is interpreted as the Unicode
169
+ // replacement character U+FFFD.
168
170
func QuoteRune (r rune ) string {
169
171
return quoteRuneWith (r , '\'' , false , false )
170
172
}
@@ -179,6 +181,8 @@ func AppendQuoteRune(dst []byte, r rune) []byte {
179
181
// the rune. The returned string uses Go escape sequences (\t, \n, \xFF,
180
182
// \u0100) for non-ASCII characters and non-printable characters as defined
181
183
// by IsPrint.
184
+ // If r is not a valid Unicode code point, it is interpreted as the Unicode
185
+ // replacement character U+FFFD.
182
186
func QuoteRuneToASCII (r rune ) string {
183
187
return quoteRuneWith (r , '\'' , true , false )
184
188
}
@@ -193,6 +197,8 @@ func AppendQuoteRuneToASCII(dst []byte, r rune) []byte {
193
197
// the rune. If the rune is not a Unicode graphic character,
194
198
// as defined by IsGraphic, the returned string will use a Go escape sequence
195
199
// (\t, \n, \xFF, \u0100).
200
+ // If r is not a valid Unicode code point, it is interpreted as the Unicode
201
+ // replacement character U+FFFD.
196
202
func QuoteRuneToGraphic (r rune ) string {
197
203
return quoteRuneWith (r , '\'' , false , true )
198
204
}
0 commit comments