Justin
Justin

Reputation: 849

Stop visual studio from changing file encoding on save

I am using Visual Studio Express 2012 for Web to edit some ANSI encoded html and javascript files. When I save the changes VS is changing the encoding of the files to UTF-8 with BOM.

Visual Studio issues the following warning:

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.

Is there a way to make Visual Studio save files without changing encoding?

Upvotes: 3

Views: 4273

Answers (1)

Jared
Jared

Reputation: 50

In your HTML files, put the following <meta> tag between the <head> and </head> tags:

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

Next, save the files—Visual Studio will detect the <meta> tag and save the files in Windows-1252 (ANSI) encoding.

Upvotes: 2

Related Questions