shithub: neatroff

Download patch

ref: 19964e45f77c190d9c46228825d5974db995b653
parent: 1eadad7e80537cbc584451767a35383c8a47f259
author: Ali Gholami Rudi <[email protected]>
date: Sun May 22 08:28:22 EDT 2016

char: fix reading utf-8 characters with more than three bytes

Reported by Gianni Chiappetta <[email protected]>.

--- a/char.c
+++ b/char.c
@@ -13,11 +13,11 @@
 		return 2;
 	if (~c & 0x10)
 		return 3;
-	if (~c & 0x80)
+	if (~c & 0x08)
 		return 4;
-	if (~c & 0x40)
+	if (~c & 0x04)
 		return 5;
-	if (~c & 0x20)
+	if (~c & 0x02)
 		return 6;
 	return 1;
 }