1
This commit is contained in:
Alex Yatskov 2016-11-19 23:03:46 -08:00
parent 32dc5fafb9
commit ab54805f80

View File

@ -58,8 +58,8 @@ static void encode_sequence(char output[], int size, const char utf8[]) {
int offset = strlen(output); int offset = strlen(output);
for (int i = 0; i < MAX_UTF8_BYTES; ++i) { for (int i = 0; i < MAX_UTF8_BYTES; ++i) {
const char c = utf8[i]; const unsigned char byte = utf8[i];
if (c == 0) { if (byte == 0) {
break; break;
} }
@ -67,13 +67,13 @@ static void encode_sequence(char output[], int size, const char utf8[]) {
break; break;
} }
output[offset++] = hex[c >> 0x08]; output[offset++] = hex[byte >> 0x04];
if (offset >= size - 1) { if (offset >= size - 1) {
break; break;
} }
output[offset++] = hex[c & 0x0f]; output[offset++] = hex[byte & 0x0f];
} }
output[offset] = 0; output[offset] = 0;