I use "gcc -finput-charset=utf-8 -fexec-charset=gb2312" to compile utf-8 encoding source files under windows. Most of the time it works well, but when the source file contains some characters such as "—", gcc will fail and the error message is: "[Error] converting to execution character set: Illegal byte sequence".
The attached file is an example. I have tested the file by using iconv to convert it from utf-8 to gbk, and iconv works with no complaints. So maybe there's something wrong when gcc is trying to do the encoding conversion? Some information: Toolchain: MinGW-W64-i686, gcc 10.2 System: Windows 10 Simplified Chinese Home edition ver 2004
testencoding.cpp
Description: Binary data