In C++, a space character is reported as non-printable by `std::ctype<wchar_t>` in the "C" locale (the only locale supported by `std::ctype`). In other words, the following expression evaluates to `false`:
ctype.is(std::ctype_base::print, ctype.widen(' ')) where `ctype` is obtained by `std::use_facet<std::ctype<wchar_t>>(loc)` and `loc` is the "C" locale. It should have been evaluated to `true` because a space character is required by the C++ standard to be categorized as printable. Also, it is reported as printable by `std::iswprint(int ch)`. Also, the non-wide space character is reported as printable, i.e, `std::use_facet<std::ctype<char>>(loc)::is(std::ctype_base::print, ' ')` is `true`. Also, `ctype.is(std::ctype_base::print, ctype.widen(' '))` is `true` with MinGW, with GCC on Linux, and with Visual Studio. The problem can be demonstrated with the code below in regular Cygwin ( https://cygwin.com/install.html) using GCC 12.3.1 and in the Cygwin environment of MSYS2 (https://www.msys2.org/) using GCC 13.2.0: #include <cwctype> #include <string> #include <locale> #include <iostream> int main() { using facet_type = std::ctype<wchar_t>; std::locale loc; const auto& ctype = std::use_facet<facet_type>(loc); wchar_t ch = ctype.widen(' '); std::cout << ctype.is(ctype.print, ch) << "\n"; std::cout << (std::iswprint(std::char_traits<wchar_t>::to_int_type(ch)) != 0) << "\n"; } Regards Kristian Spangsege -- Problem reports: https://cygwin.com/problems.html FAQ: https://cygwin.com/faq/ Documentation: https://cygwin.com/docs.html Unsubscribe info: https://cygwin.com/ml/#unsubscribe-simple