3

我正在使用 Visual Studio Express 2012 for Web 来编辑一些 ANSI 编码的 html 和 javascript 文件。当我保存更改时,VS 将文件的编码更改为带有 BOM 的 UTF-8。

Visual Studio 发出以下警告:

The character encoding for the file file.htm has changed. Your source control provider may have problems managing files with this type of encoding. For example, if you save an ANSI-encoded file as UTF-8 you may not be able to merge or show differences.

有没有办法让 Visual Studio 保存文件而不更改编码?

4

1 回答 1

2

在您的 HTML 文件中,在和标签<meta>之间放置以下标签:<head></head>

<meta http-equiv="Content-Type" content="text/html; charset=windows-1252" />

接下来,保存文件——Visual Studio 将检测<meta>标记并将文件保存为 Windows-1252 (ANSI) 编码。

于 2013-10-16T05:00:11.867 回答