在 2025-6-6 20:31, Kirill Makurin 写道:
diff --git a/mingw-w64-crt/misc/btowc.c b/mingw-w64-crt/misc/btowc.c index c8fbd8e74..e203bbc44 100644 --- a/mingw-w64-crt/misc/btowc.c +++ b/mingw-w64-crt/misc/btowc.c @@ -15,14 +15,18 @@ wint_t btowc (int c) ... ... + unsigned cp = ___lc_codepage_func(); + + /* "C" locale */ + if (cp == 0) + return (unsigned) c < 0xFF ? c : WEOF;
I think you meant `(unsigned) c <= 0xFF` here?
diff --git a/mingw-w64-crt/misc/wctob.c b/mingw-w64-crt/misc/wctob.c index 995f6db6e..eddf9d20b 100644 --- a/mingw-w64-crt/misc/wctob.c +++ b/mingw-w64-crt/misc/wctob.c @@ -14,16 +14,22 @@ ... ... + /* "C" locale, use code page 20127 (ASCII) for conversion */ + if (cp == 0) + cp = 20127; +
20127 produces 7-bit results which is not the inverse of `btowc()`. How about 28591? 28591 iso-8859-1 ISO 8859-1 Latin 1; Western European (ISO) -- 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