Visual Studio 2005 .vcproj文件不会保持编码为UTF-8

时间:2022-01-20 18:59:25

The problem: I edit a .vcproj file, save it as UTF-8 (and specify that in the xml header), and when I open it in VS, the next time it saves it the encoding reverts back to CP-1255/1252/1251 (depending on the Localized Settings on the machine).

问题:我编辑.vcproj文件,将其保存为UTF-8(并在xml标头中指定),当我在VS中打开它时,下次保存时,编码将恢复为CP-1255/1252 / 1251(取决于机器上的本地化设置)。

This has become a problem in our R&D, since whenever someone commits a .vcproj file the encoding changes according to their machine's configuration. How can I configure VS to just use UTF-8 and stop this back and forth ANSI encoding dance?

这已经成为我们研发中的一个问题,因为每当有人提交.vcproj文件时,编码就会根据其机器的配置而变化。如何配置VS只使用UTF-8并停止这种来回的ANSI编码跳舞?

2 个解决方案

#1


cheap answer: make all dev pc's have same Localized Settings.

便宜的答案:让所有开发电脑拥有相同的本地化设置。

#2


Maybe you should try adding the BOM (http://en.wikipedia.org/wiki/Byte_order_mark) to your files. I know of one program which can do it for you, it's actually just 3 bytes at the beginning of your files. Go into the "Format" menu and try the different UTF-8 options.

也许您应该尝试将BOM(http://en.wikipedia.org/wiki/Byte_order_mark)添加到您的文件中。我知道有一个程序可以为你做,它实际上只是文件开头的3个字节。进入“格式”菜单并尝试不同的UTF-8选项。

#1


cheap answer: make all dev pc's have same Localized Settings.

便宜的答案:让所有开发电脑拥有相同的本地化设置。

#2


Maybe you should try adding the BOM (http://en.wikipedia.org/wiki/Byte_order_mark) to your files. I know of one program which can do it for you, it's actually just 3 bytes at the beginning of your files. Go into the "Format" menu and try the different UTF-8 options.

也许您应该尝试将BOM(http://en.wikipedia.org/wiki/Byte_order_mark)添加到您的文件中。我知道有一个程序可以为你做,它实际上只是文件开头的3个字节。进入“格式”菜单并尝试不同的UTF-8选项。