In four byte UTF-8 sequences, only three bits of the first byte should

be used. Fix from Koga Osamu.
This commit is contained in:
nicm 2014-03-31 21:43:35 +00:00
parent 48478ea0a9
commit ee19d304ff

2
utf8.c
View File

@ -311,7 +311,7 @@ utf8_combine(const struct utf8_data *utf8data)
value = utf8data->data[3] & 0x3f; value = utf8data->data[3] & 0x3f;
value |= (utf8data->data[2] & 0x3f) << 6; value |= (utf8data->data[2] & 0x3f) << 6;
value |= (utf8data->data[1] & 0x3f) << 12; value |= (utf8data->data[1] & 0x3f) << 12;
value |= (utf8data->data[0] & 0x3f) << 18; value |= (utf8data->data[0] & 0x07) << 18;
break; break;
} }
return (value); return (value);