https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95048
--- Comment #7 from Jonathan Wakely <redi at gcc dot gnu.org> --- (In reply to Christian Fersch from comment #6) > It seems like the solution would be to use codecvt_utf8 if wchar_t is 32bit > and codecvt_utf8_utf16 if wchar_t is 16bit. This also seems to be what > libc++ is doing. Would you accept a patch for this? Doesn't this have the problem I pointed out in comment 5? Using codecvt_utf8 assumes that the wchar_t encoding is either UCS-2 or UCS-4. GCC supports changing that encoding using the -fwide-exec-charset= option. > Do we need to handle systems where wchar_t is something other than 16 or 32 > bit wide? No.