Skip to content

Commit c320c2d

Browse files
committed
Fix utf8.RuneError test
arp242/uni@5f9eb0d This is actually not really an issue here, because U+FFFD isn't valid in TOML, but it doesn't hurt to properly check.
1 parent 6fb5266 commit c320c2d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lex.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ func (lx *lexer) next() (r rune) {
166166
}
167167

168168
r, w := utf8.DecodeRuneInString(lx.input[lx.pos:])
169-
if r == utf8.RuneError {
169+
if r == utf8.RuneError && w == 1 {
170170
lx.error(errLexUTF8{lx.input[lx.pos]})
171171
return utf8.RuneError
172172
}

0 commit comments

Comments
 (0)