``` This is not specific to UCRT. It looks like legacy CRT behavior; all MSVCR* DLLs are also affected. ```
Yes, this issue seems to come from old CRTs. My wording probably wasn't clear, UCRT-specific part was that return value is correct with UTF-8 locales. ``` I have no idea about how widely locales are used on Windows. ``` Many applications may call setlocale(LC_ALL, ""). If they use gettext, they will call GNU libintl's replacement which checks LC_* and LANG environment variables. There is always a chance it will set locale which uses DBCS code page. One could expect ISO C conversion functions to work properly if they don't use iconv(3). ``` If we decide to provide replacements for broken Microsoft ones, which then nobody will use, there's probably little worth in doing that. ``` This is a good point. I think the most common use of ISO C conversion functions is: mbstate_t state ={0}; // or memset size_t buffer_size = mbsrtowcs (NULL, &str, 0, &state); If (buffer_size == (size_t)-1) // handle conversion error wchar_t *buffer = malloc ((buffer_size + 1) * sizeof (wchar_t)); If (!buffer) // handle out-of-memory mbsrtowcs (buffer, &str, buffer_size + 1, &state); or the same logic for wcsrtombs. I don't think there are many (if any) people who try to convert strings char-by-char, let alone people who would call mbrtowc with anything but MB_CUR_MAX. - Kirill Makurin _______________________________________________ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public