From: Owen Shepherd Date: Fri, 11 Jan 2013 18:17:56 +0000 (+0000) Subject: PDCLIB-2 PDCLIB-12 Correct surrogate behaviour of internal UTF-16 <-> UTF-32 helper... X-Git-Url: https://pd.if.org/git/?p=pdclib.old;a=commitdiff_plain;h=2760171eacbcdecc1fb28a76323aa9ceb06da921 PDCLIB-2 PDCLIB-12 Correct surrogate behaviour of internal UTF-16 <-> UTF-32 helper functions (although their future is unclear) --- diff --git a/internals/_PDCLIB_encoding.h b/internals/_PDCLIB_encoding.h index f4b837f..cec3089 100644 --- a/internals/_PDCLIB_encoding.h +++ b/internals/_PDCLIB_encoding.h @@ -75,12 +75,12 @@ static inline _PDCLIB_size_t _PDCLIB_c32rtoc16( 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; } }