TheAssemblyArmada / Thyme

An open source re-implementation of Generals : Zero Hour written in C++.
GNU General Public License v2.0
569 stars 54 forks source link

Translate_Internal: UTF16->UTF8 not working with ICU #662

Open feliwir opened 2 years ago

feliwir commented 2 years ago

On Ubuntu 21.10 our Translate_Internal functions gives me error: U_BUFFER_OVERFLOW_ERROR on the following lines:

int32_t utf8_len;
UErrorCode error = U_ZERO_ERROR;
// Get utf8 string length.
u_strToUTF8(nullptr, 0, &utf8_len, utf16_string, utf16_len, &error);

This results in every "translated" string being empty

xezon commented 2 years ago

And this error is from this exact call you posted? I checked documentation and usage looks ok on first sight. https://unicode-org.github.io/icu-docs/apidoc/dev/icu4c/ustring_8h.html#a69430352fe5439927f48b98b209939d7