Skip to content

Commit 8c2ea16

Browse files
committed
ext/intl: Use ICU U16_APPEND_UNSAFE macro for UTF-16 surrogate pair encoding
1 parent 631c366 commit 8c2ea16

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

ext/intl/converter/converter.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -167,9 +167,9 @@ static void php_converter_append_toUnicode_target(zval *val, UConverterToUnicode
167167
if (lval > 0xFFFF) {
168168
/* Supplemental planes U+010000 - U+10FFFF */
169169
if (TARGET_CHECK(args, 2)) {
170-
/* TODO: Find the ICU call which does this properly */
171-
*(args->target++) = (UChar)(((lval - 0x10000) >> 10) | 0xD800);
172-
*(args->target++) = (UChar)(((lval - 0x10000) & 0x3FF) | 0xDC00);
170+
int32_t offset = 0;
171+
U16_APPEND_UNSAFE(args->target, offset, lval);
172+
args->target += offset;
173173
}
174174
return;
175175
}

0 commit comments

Comments
 (0)