From f50a3abc8eb5eb91ede6f294da64b54f02a54533 Mon Sep 17 00:00:00 2001 From: peri4 Date: Sun, 8 Feb 2026 17:01:52 +0300 Subject: [PATCH] PIString::buildData for ICU fix according to official doc --- libs/main/text/pistring.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/main/text/pistring.cpp b/libs/main/text/pistring.cpp index 534bc955..db3b9da8 100644 --- a/libs/main/text/pistring.cpp +++ b/libs/main/text/pistring.cpp @@ -469,7 +469,7 @@ void PIString::buildData(const char * cp) const { UErrorCode e((UErrorCode)0); UConverter * cc = ucnv_open(cp, &e); if (cc) { - const size_t len = MB_CUR_MAX * size() + 1; + const size_t len = UCNV_GET_MAX_BYTES_FOR_STRING(size(), ucnv_getMaxCharSize(cc)) + 1; // MB_CUR_MAX * size() + 1; data_ = (char *)malloc(len); int sz = ucnv_fromUChars(cc, data_, len, (const UChar *)(d.data()), d.size_s(), &e); ucnv_close(cc);