Commit 608c3edc05f for php.net
commit 608c3edc05f2422cd33ca343c5932670e7834a5d
Author: Weilin Du <108666168+LamentXU123@users.noreply.github.com>
Date: Wed May 6 02:38:29 2026 +0800
ext/intl: Use ICU U16_APPEND_UNSAFE macro for UTF-16 surrogate pair encoding (#21954)
diff --git a/ext/intl/converter/converter.cpp b/ext/intl/converter/converter.cpp
index 051f3ca8bd3..430d58c8f02 100644
--- a/ext/intl/converter/converter.cpp
+++ b/ext/intl/converter/converter.cpp
@@ -167,9 +167,9 @@ static void php_converter_append_toUnicode_target(zval *val, UConverterToUnicode
if (lval > 0xFFFF) {
/* Supplemental planes U+010000 - U+10FFFF */
if (TARGET_CHECK(args, 2)) {
- /* TODO: Find the ICU call which does this properly */
- *(args->target++) = (UChar)(((lval - 0x10000) >> 10) | 0xD800);
- *(args->target++) = (UChar)(((lval - 0x10000) & 0x3FF) | 0xDC00);
+ int32_t offset = 0;
+ U16_APPEND_UNSAFE(args->target, offset, lval);
+ args->target += offset;
}
return;
}