void appendByte(std::string &outstr,
uint8_t byte) {
- char tmp2[4];
+ char tmp2[5];
sprintf(tmp2, "\\x%02X", 0xFF & (int)(byte));
outstr += tmp2;
}
tmp[i] = linestr[++pos];
}
tmp[chars] = 0;
- UChar32 ch;
- sscanf(tmp, "%X", &ch);
+ unsigned int c;
+ sscanf(tmp, "%X", &c);
+ UChar32 ch = c & 0x1FFFFF;
// now to append \\x%% etc
uint8_t bytesNeeded = U8_LENGTH(ch);
size_t seqLen = (i-pos);
- //printf("U+%04X pos %d [len %d]\n", c, pos, seqLen);
+ //printf("U+%04X pos %d [len %d]\n", c, pos, seqLen);fflush(stdout);
- char newSeq[] = "\\U0000FFFD";
+ char newSeq[20];
if( c <= 0xFFFF) {
sprintf(newSeq, "\\u%04X", c);
} else {