2012-08-31 13 views
9

Linux/x86_64 üzerinde GCC 4.7, C kaynak dosyalarındaki dize değişmezlerinin içeriğini doğruladığı ve kodladığı bir varsayılan karakter kodlamasına sahip midir? Bu yapılandırılabilir mi? Ayrıca, dize değişmezlerinden gelen dize verilerini çıktıların veri bölümüne bağlarken, varsayılan yürütme karakter kodlaması var mıdır? Bu yapılandırılabilir mi?GCC 4.7 Dize Literalleri İçin Kaynak Karakter Kodlaması ve Yürütme Karakter Kodlaması?

Herhangi bir yapılandırmada, yürütme karakter kodlamasından farklı bir kaynak karakter kodlamasına sahip olmak mümkün müdür? (Bu kod, karakter kodlamaları arasında hiç değişmez mi?)

cevap

11

Bu seçeneklerin ne kadar iyi çalıştığını bilmiyorum (bunları kullanmama at ;; Hala dizgi değişmezlerini "yalnızca ASCII" olarak kullanmayı tercih ediyorum, çünkü yerelleştirilmiş dizeler o biçim dizeleri veya dosya adları) gibi çoğunlukla şeyler, ama onlar

-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. 
+0

src ve exec kodlama varsayılan UTF-8 olduğu zaman, aslında hem edebi dize doğrular acaba gibi seçenekler ekledik böylece zaten harici dosyalar biçimlendirilmiş UTF-8 ve geçersiz bayt dizileri içeriyorsa ya da yalnızca geçersiz baytların geçmesine izin veriyorsa bir hata ortaya çıkarır. –