return 1;
} else {
// Supplementary plane character
- *out = 0xD800 | (*in & 0x3FF);
+ *out = 0xD800 | (*in >> 10);
if(bufsize >= 2) {
- out[1] = 0xDC00 | (*in >> 10);
+ out[1] = 0xDC00 | (*in & 0x3FF);
return 2;
} else {
- ps->_Surrogate = 0xDC00 | (*in >> 10);
+ ps->_Surrogate = 0xDC00 | (*in & 0x3FF);
return 1;
}
}