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:
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:
.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.
Copyright 2008 - 2024 Vlasov Studio (Best in class Visual Studio extensions and tools)