https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89118
--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> --- The classic "C" locale does not use UTF-8, so the codecvt<wchar_t, char, mbstate_t> facet doesn't perform conversions to UTF-8. If I use: std::locale::global(std::locale("C.UTF-8")); then the results are correct. I think that's the correct behaviour.