在 2025-6-3 19:11, Kirill Makurin 写道:
Oh, my bad. I was thinking I was calling MSVCRT's `btowc`, not the replacement.

I tried calling real `btowc` and its behavior matches UCRT. I also tried loading msvcr100.dll, it has the same behavior.

So, I think we could check return value of `___lc_codepage_func()` and for "C" locale, return values in range [0,255] as is and return WEOF if value is outside this range.

Should we change behavior so that replacement is used only when there is no real `btowc`? I do not fully understand how this mechanism works.

Btw, glibc's `btowc` returns WEOF for characters in range [128,255] with "C" locale. The behavior of btowc not returning WEOF for values in range [128,255] seems to be new. Existing manpages do not mention it.


This?  https://man7.org/linux/man-pages/man3/btowc.3p.html#RETURN_VALUE

If you can find the rationale about the glibc change, I think it's fine to 
adopt the POSIX behavior.



--
Best regards,
LIU Hao

Attachment: 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

Reply via email to