https://gcc.gnu.org/bugzilla/show_bug.cgi?id=41041
--- Comment #8 from Jonathan Wakely <redi at gcc dot gnu.org> --- The difference with an explicit -fwide-exec-charset=UTF-32 seems to be the BOM. It looks like the default is UTF-32LE, are you sure it's UCS4?