From c320c2d09774325e4cadbcfbe76a6d23935bd0e2 Mon Sep 17 00:00:00 2001 From: Martin Tournoij Date: Sun, 3 Dec 2023 21:41:56 +0000 Subject: [PATCH] Fix utf8.RuneError test https://github.com/arp242/uni/commit/5f9eb0d056eea25817d18995013406c23727242d This is actually not really an issue here, because U+FFFD isn't valid in TOML, but it doesn't hurt to properly check. --- lex.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lex.go b/lex.go index 0356bc49..a1016d98 100644 --- a/lex.go +++ b/lex.go @@ -166,7 +166,7 @@ func (lx *lexer) next() (r rune) { } r, w := utf8.DecodeRuneInString(lx.input[lx.pos:]) - if r == utf8.RuneError { + if r == utf8.RuneError && w == 1 { lx.error(errLexUTF8{lx.input[lx.pos]}) return utf8.RuneError }