Fix File Encoding Fix File Encoding

The free Fix File Encoding extension prevents Visual Studio 2022/2019/2017 from adding BOM to UTF-8 files.

Normally, when you edit a UTF-8 file in Visual Studio, it adds the byte order mark (BOM) sequence 0xEF, 0xBB, 0xBF to the beginning of the file. Sometimes it confuses other applications further processing the file. You can select an encoding manually (File - Advanced Save Options... or File - Save As... - Save with Encoding...), but you need to do it each time you reopen the file:

Advanced Save Options in Visual Studio

Fix File Encoding automatically detects when a UTF-8 file is opened in Visual Studio and sets its encoding to UTF-8 without signature. If you don't edit the file, it remains unmodified. If you edit the file, it will be saved without the BOM.

Fix File Encoding lets you configure which files to encode based on the file path and the file extension. By default, only .htm and .html files are protected from Visual Studio:

Fix File Encoding Options in Visual Studio

.NET regular expressions syntax is used to select files. Some examples:
Protect all files from the "m:\temp" directory: ^m:\\temp
Protect ".html" files from the "m:\temp" directory: ^m:\\temp.+\.html$
Protect all files: empty regex box.

Fix File Encoding v1.5.0 - February 23, 2022. Download Now

 

Organize Visual Studio tabs with Tabs Studio add-in