Linux/x86_64 上的 GCC 4.7 是否具有默认字符编码,通过它可以验证和解码 C 源文件中字符串文字的内容?这是可配置的吗?
此外,当将字符串数据从字符串文字链接到输出的数据部分时,它是否具有默认的执行字符编码?这是可配置的吗?
在任何配置中,是否有可能具有与执行字符编码不同的源字符编码?(也就是说 gcc 会在字符编码之间进行转码吗?)
Linux/x86_64 上的 GCC 4.7 是否具有默认字符编码,通过它可以验证和解码 C 源文件中字符串文字的内容?这是可配置的吗?
此外,当将字符串数据从字符串文字链接到输出的数据部分时,它是否具有默认的执行字符编码?这是可配置的吗?
在任何配置中,是否有可能具有与执行字符编码不同的源字符编码?(也就是说 gcc 会在字符编码之间进行转码吗?)
我不知道这些选项的实际效果如何(不使用它们 atm;我仍然更喜欢将字符串文字视为“仅 ASCII”,因为本地化字符串无论如何都来自外部文件,所以它主要是格式字符串或文件名之类的东西),但它们添加了选项,例如
-fexec-charset=charset
Set the execution character set, used for string and character constants. The default
is UTF-8. charset can be any encoding supported by the system's iconv library routine.
-fwide-exec-charset=charset
Set the wide execution character set, used for wide string and character constants.
The default is UTF-32 or UTF-16, whichever corresponds to the width of wchar_t. As
with -fexec-charset, charset can be any encoding supported by the system's iconv
library routine; however, you will have problems with encodings that do not fit
exactly in wchar_t.
-finput-charset=charset
Set the input character set, used for translation from the character set of the
input file to the source character set used by GCC. If the locale does not specify,
or GCC cannot get this information from the locale, the default is UTF-8. This can
be overridden by either the locale or this command line option. Currently the command
line option takes precedence if there's a conflict. charset can be any encoding
supported by the system's iconv library routine.