[Solved] error converting to execution character set illegal byte sequence

Today, after writing a program, I found that the compiler always reports an error: error converting to execution character set illegal byte sequence. When compiling by default, it is parsed according to UTF-8, and when the character set is not specified, it is always treated as UTF-8. So you have to add the following in settings->compiler->Global compiler settings->Other options:

-fexec-charset=GBK
-finput-charset=UTF-8

The former represents the encoding interpretation format of the input file during compilation, and the latter represents the encoding format used for the display of the generated execution file during execution.

At the same time. In settings -> Editor-> gernal settings-> Other settings, set the file encoding format saved by default to UTF-8, and keep the encoding formats of both sides the same.

But after I did this, I found it useless… Later, I found that my program didn’t know when it was changed to ANSI format, so it had been either compiled incorrectly or Chinese garbled.

To solve this problem, you can open the code file with notepad and select the file – & gt; How to select the encoding format of UTF-8 to save as.

Read More: