From dea9c19da4761f40a3800c402b8740180598002e Mon Sep 17 00:00:00 2001 From: Rafael Villalobos <41552468+rvillalob@users.noreply.github.com> Date: Mon, 24 Sep 2018 08:52:17 -0700 Subject: [PATCH] Update utf8.c The function unicode_to_utf8 was failing to produce the correct leading byte of the UTF8 sequence because the loop was stopping one iteration too soon. --- utf8.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utf8.c b/utf8.c index 3bffd1e..a52d3c9 100644 --- a/utf8.c +++ b/utf8.c @@ -90,7 +90,7 @@ unsigned unicode_to_utf8(unsigned int c, char *utf8) bytes++; prefix >>= 1; c >>= 6; - } while (c > prefix); + } while (c >= prefix); *p = c - 2*prefix; reverse_string(utf8, p); }