Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

It seems that Visual Studio 2012 hates UTF-8 without BOM and always adds it, resulting in an empty line in PHP pages.

How can I change the encoding to UTF-8 without BOM (or at least to Unicode...)

share|improve this question
    
Please add some more info about what you are doing. –  harrymc Feb 5 '13 at 16:23
    
I can not save documents with UTF-8 without BOM encoding using Visual Studio 2012. I have to edit the file in Notepad++ every time to change to that encoding. –  Cristy Feb 5 '13 at 18:20
add comment

1 Answer

up vote 6 down vote accepted
+50

See the free Fix File Encoding extension :

The free Fix File Encoding extension prevents Visual Studio 2012/2010 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 .html files are protected from Visual Studio.

I have no experience with this extension, but it sounds like it answers your needs.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.