在 2023/3/21 17:15, 傅继晗 写道:
Yes,MSVCRT doesn't recognize UTF-8.After debuging,I figure out that
setlocale(LC_CTYPE,
".UTF8"); is equal to setlocale(LC_CTYPE, 0); in MSVCRT. And
setlocale(LC_CTYPE,
0); also make it work in UCRT.So,instead of setlocale(LC_CTYPE,
".UTF8"); setlocale(LC_CTYPE,
0);` is the temporary solution in both cases.Although I don't why,but I it
works anyway,I have test it with GBK,UTF8 and ISO8859-6.


What's the purpose of this patch?

`setlocale(LC_CTYPE, "")` means to 'set' the locale in an implementation-defined way. Typically this means to obtain the current locale from your system, via configuration or environment variables. This is necessary because a program starts in the "C" locale.

`setlocale(LC_CTYPE, 0)` is equivalent to `setlocale(LC_CTYPE, NULL)` and gets the name of the current locale, without actually modifying it. In your patch you discard its result so it does nothing.


--
Best regards,
LIU Hao

Attachment: OpenPGP_signature
Description: OpenPGP digital signature

_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to