如何在 Visual Studio 中设置标准编码 [英] How to set standard encoding in Visual Studio

查看:63
本文介绍了如何在 Visual Studio 中设置标准编码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找一种设置 Visual Studio 的方法,以便它始终以 UTF-8 格式保存我的文件.

I am searching for a way to setup Visual Studio so it always saves my files in UTF-8.

我只找到了设置此项目范围的选项.有没有办法在 Visual Studio 范围内设置它?

I have only found options to set this project wide. Is there a way to set it Visual Studio wide?

推荐答案

您是否希望将文件另存为 UTF-8,因为您正在使用在 ASCII 编码中会丢失的特殊字符?如果是这样,那么 Tools > 中有一个 VS2008 全局设置.选项 >环境 >文档,命名为当代码页无法保存数据时,将文档另存为Unicode.启用此选项后,如果某些字符无法在其他默认代码页中表示,VS2008 将另存为 Unicode.

Do you want the files to save as UTF-8 because you are using special characters that would be lost in ASCII encoding? If that's the case, then there is a VS2008 global setting in Tools > Options > Environment > Documents, named Save documents as Unicode when data cannot be saved in codepage. When this is enabled, VS2008 will save as Unicode if certain characters cannot be represented in the otherwise-default codepage.

此外,哪些文件被保存为 UTF-8?默认情况下,我所有的 .cs、.csproj、.sln、.config、.as*x 等文件都保存为 UTF-8(带有签名、字节顺序标记).

Also, which files are not being saved as UTF-8? All of my .cs, .csproj, .sln, .config, .as*x, etc, all save as UTF-8 (with signature, the byte order marks), by default.

这篇关于如何在 Visual Studio 中设置标准编码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆