From f2dfec1ffb27139826225469f31fa7d577e29e75 Mon Sep 17 00:00:00 2001 From: Yuri Pankov Date: Mon, 26 Nov 2018 15:33:55 +0000 Subject: [PATCH] vi: fix UTF-8 detection. PR: 202290 Submitted by: lampa@fit.vutbr.cz Reviewed by: bapt Approved by: kib (mentor, implicit) MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D17950 --- contrib/nvi/common/encoding.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/nvi/common/encoding.c b/contrib/nvi/common/encoding.c index 7bdcf7069238..bcbc0680950d 100644 --- a/contrib/nvi/common/encoding.c +++ b/contrib/nvi/common/encoding.c @@ -96,7 +96,7 @@ looks_utf8(const char *ibuf, size_t nbytes) if (i >= nbytes) goto done; - if (buf[i] & 0x40) /* 10xxxxxx */ + if ((buf[i] & 0xc0) != 0x80) /* 10xxxxxx */ return -1; }