Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 912
Justin Avatar asked Jul 26 '26 20:07

Justin


1 Answers

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.

like image 181
Jared Avatar answered Jul 29 '26 22:07

Jared