在 2025-6-7 18:40, Kirill Makurin 写道:
Thank you for details.There is msvcp60.def which exports wctob and btowc, I am not sure if I should touch it.If we don't take POSIX behavior for btowc with "C" locale for input in range [128,255], and since we replace them both for all CRTs, I think we could limit range of valid input to [0,127] to be consistent with existing implementations like glibc.Initially, the idea to allow values in range [0,255] in "C" locale was to match CRTs behavior. What do you think?
Looks like that the behavior of `btowc()` is defined as: ``` wint_t btowc(int c) { if(c == EOF) return WEOF; wchar_t wc; char ch = (char) c; mbstate_t st = { 0 }; if(mbrtowc(&wc, &ch, 1, &st) != 1) return WEOF; return wc; } ``` The UCRT `mbrtowc()` function doesn't fail for characters in [128,255]. -- Best regards, LIU Hao
OpenPGP_signature.asc
Description: OpenPGP digital signature
_______________________________________________ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public