diff --git a/Src/utils.c b/Src/utils.c index 733f570..32e7dc6 100644 --- a/Src/utils.c +++ b/Src/utils.c @@ -5341,7 +5341,12 @@ mb_metastrlenend(char *ptr, int width, char *eptr) inchar = *ptr; ptr++; - if (complete && (inchar >= 0 && inchar <= 0x7f)) { + /* + * 0x7f is all ones except for top bit in binary, + * this will check if inchar is in range 0 .. 127 + * inclusive, regardless of char signedness + */ + if (complete && (inchar & 0x7f) == inchar) { /* * We rely on 7-bit US-ASCII as a subset, so skip * multibyte handling if we have such a character.