A byte order mark (BOM) cannot be backquoted.
LGTM=r
R=golang-codereviews, gobot, r
CC=golang-codereviews
https://golang.org/cl/
112310043
r, wid := utf8.DecodeRuneInString(s)
s = s[wid:]
if wid > 1 {
- continue // All multibyte runes are correctly encoded and assumed printable.
+ if r == '\ufeff' {
+ return false // BOMs are invisible and should not be quoted.
+ }
+ continue // All other multibyte runes are correctly encoded and assumed printable.
}
if r == utf8.RuneError {
return false
{`☺`, true},
{"\x80", false},
{"a\xe0\xa0z", false},
- {"\ufeffabc", true},
- {"a\ufeffz", true},
+ {"\ufeffabc", false},
+ {"a\ufeffz", false},
}
func TestCanBackquote(t *testing.T) {