Skip to content

Commit

Permalink
FIX: Accept <= 0x7F
Browse files Browse the repository at this point in the history
I only tested with utf-8 combinations so I forgot to accept ASCII
chars ...
  • Loading branch information
Julien Palard committed May 17, 2012
1 parent 38d621e commit fd85b51
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion is_utf8.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ int is_utf8(unsigned char *str, size_t len)

while (i < len)
{
if (str[i] >= 0xC0 /*11000000*/ && str[i] <= 0xDF /*11011111*/)
if (str[i] <= 0x7F)
continuation_bytes = 0;
else if (str[i] >= 0xC0 /*11000000*/ && str[i] <= 0xDF /*11011111*/)
continuation_bytes = 1;
else if (str[i] >= 0xE0 /*11100000*/ && str[i] <= 0xEF /*11101111*/)
continuation_bytes = 2;
Expand Down

0 comments on commit fd85b51

Please sign in to comment.