From 8c2ea16633d87f4cd8dbdb57198d46b6c248c94c Mon Sep 17 00:00:00 2001 From: lamentxu <1372449351@qq.com> Date: Wed, 6 May 2026 00:13:25 +0800 Subject: [PATCH] ext/intl: Use ICU U16_APPEND_UNSAFE macro for UTF-16 surrogate pair encoding --- ext/intl/converter/converter.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ext/intl/converter/converter.cpp b/ext/intl/converter/converter.cpp index 051f3ca8bd3a..430d58c8f025 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; }