VS2015支持UTF-8 with BOM编码格式处理中文、西班牙文、法文等非英文字符

Detail:

在使用VS2015编译ImageMagicK库时,由于其中源码文件带有非英文字符串,导致VS编译出错。

LANGUAGE(
	 bn	/* Bengali */,
	 GLASS,
	 "আমি কাঁচ খেতে পারি, তাতে আমার কোনো ক্ষতি হয় না।"
	 /* I can eat glass and it doesn't hurt me. */
	)
LANGUAGE(
	 bo	/* Tibetan */,
	 GLASS,
	 "ཤེལ་སྒོ་ཟ་ནས་ང་ན་གི་མ་རེད།"
	 /* I can eat glass and it doesn't hurt me. */
	)
LANGUAGE(
	 bs	/* Bosnian */,
	 WP-PANG,
	 "Fin džip, gluh jež i čvrst konjić dođoše bez moljca."
	 /* A nice jeep, a deaf hedgehog and a tough horse came without a moth. */
	)
LANGUAGE(
	 ca	/* Catalan */,
	 WP-PANG,
	 "Jove xef, porti whisky amb quinze glaçons d'hidrogen, coi!"
	 /* Young chef, bring whisky with fifteen hydrogen ice cubes, damn! */
	)
LANGUAGE(
	 ch	/* Chamorro */,
	 GLASS,
	 "Siña yo' chumocho krestat, ti ha na'lalamen yo'."
	 /* I can eat glass and it doesn't hurt me. */
	)
LANGUAGE(
	 cs	/* Czech */,
	 WP-SFD,
	 "Příliš žluťoučký kůň úpěl ďábelské ódy."
	 /* A too yellow horse moaned devil odes. */
	)
LANGUAGE(
	 cy	/* Welsh */,
	 GLASS,
	 "Dw i'n gallu bwyta gwydr, 'dyw e ddim yn gwneud dolur i mi."
	 /* I can eat glass and it doesn't hurt me. */
	)
LANGUAGE(
	 da	/* Danish */,
	 WP-SFD,
	 "Quizdeltagerne spiste jordbær med fløde, mens cirkusklovnen Walther spillede på xylofon."
	 /* The quiz contestants ate strawberries with cream while Walther the clown was playing the xylophone. */
	)
LANGUAGE(
	 de	/* German */,
	 WP-SFD,
	 "Zwölf Boxkämpfer jagen Viktor quer über den großen Sylter Deich."
	 /* Twelve boxing fighters drive Viktor over the great. */
	)
LANGUAGE(
	 el	/* Greek */,
	 WP-SFD,
	 "Θέλει αρετή και τόλμη η ελευθερία. (Ανδρέας Κάλβος)"
	 /* Liberty requires virtue and mettle. (Andreas Kalvos) */
	)
LANGUAGE(
	 en	/* English */,
	 GSPECI,
	 "The quick brown fox jumps over the lazy dog."
	)
LANGUAGE(
	 enm	/* Middle English */,
	 GLASS,
	 "Ich canne glas eten and hit hirtiþ me nouȝt."
	 /* I can eat glass and it doesn't hurt me. */
	)
LANGUAGE(
	 eo	/* Esperanto */,
	 WP-SFD,
	 "Eĥoŝanĝo ĉiuĵaŭde."
	 /* Change of echo every Thursday. */
	)
LANGUAGE(
	 es	/* Spanish */,
	 WP-PANG,
	 "Jovencillo emponzoñado de whisky: ¡qué figurota exhibe!"
	 /* Whisky-intoxicated youngster — what a figure he's showing! */
	)
LANGUAGE(
	 et	/* Estonian */,
	 WP-SFD,
	 "See väike mölder jõuab rongile hüpata."
	 /* This small miller is able to jump on the train. */
	)
LANGUAGE(
	 eu	/* Basque */,
	 GLASS,
	 "Kristala jan dezaket, ez dit minik ematen."
	 /* I can eat glass and it doesn't hurt me. */
	)
LANGUAGE(
	 fa	/* Persian */,
	 MISC	/* Behdad Esfahbod (#548730) */,
	 "«الا یا اَیُّها السّاقی! اَدِرْ کَأساً وَ ناوِلْها!» که عشق آسان نمود اوّل، ولی افتاد مشکل‌ها!"
	)

编译报错:error C2001: newline in constant

VS2015仅支持UTF-8 with BOM,不支持不带签名的UTF-8。所有如果源码文件带有中文、西班牙文、法文等字符,请将文件编码修改为UTF-8 with BOM而非ASCII、非UTF-8。

My Answer:

这里使用ST将文件按UTF-8 with BOM编码另存后,再重新由VS打开,编译通过!

VS2015支持UTF-8 with BOM编码格式处理中文、西班牙文、法文等非英文字符_第1张图片

你可能感兴趣的:(VS2015支持UTF-8 with BOM编码格式处理中文、西班牙文、法文等非英文字符)