Am Sun, 2 Jun 2019 07:29:28 +0200
schrieb Szyk Cech <
szyk...@spoko.pl>:
You need to desynchronize stdio and std::ios:
std::ios::sync_with_stdio(false);
and also imbue a utf8 locale to both cout and wcout:
std::cout.imbue(std::locale(""));
std::wcout.imbue(std::locale(""));
(This works here because std::locale("") gives the default locale in the
environment which happens to be de_DE.UTF-8 in my case.)
Doing so at the beginning of each version of main gives:
zażółć gęślą jaźń
and
sizeof(wchar_t): 4
zażółć gęślą jaźń
zażółć gęślą jaźń
zażółć gęślą jaźń
respectively.