Visual Studio Express 2013 for Web - Save file with encoding unchanged
Asked Answered
F

1

6

VSEW 2013 is changing the encoding of a file when it saves it - a problem that did not occur for me in VSEW 2012. I cannot remember whether I changed the config. to prevent this in VSEW 2012, or whether it worked as required by default.

In any case I cannot work out how to conserve the encoding, except for each file individually via File > Save As and explicitly setting the required encoding. It would be tedious (and very error-prone) to rely on this approach.

In particular, an HTML file originally encoded as UTF-8 without BOM (without signature) is saved as UTF-8 with BOM by VSEW 2013.

Is there any global setting to prevent VSEW 2013 from changing the encoding, or to set it always to use UTF-8 without BOM?

JPL

P.S. The free Fix File Encoding extension (FixFileEncoding_11.vsix) from Vlasov Studio does what is required (and more), but can be installed on Visual Studio Pro only, not the Express version. http://vlasovstudio.com/fix-file-encoding/index.html

Fruity answered 21/10, 2013 at 18:17 Comment(3)
Thanks for fixing the typo. But does no-one have any experience of how to fix this? Surely no-one actually wants to have a BOM inserted in HTML files? This is a breaker for me - if there is no fix or easy work-around, I shall have to revert to the 2012 version or switch to a different HTML/JS/CSS editor.Fruity
It seems that this problem does not apply to all text files, as I originally thought, but only to HTML files containing <meta charset="UTF-8">, i.e. in my case all my web pages (a few hundred of them). I have in the past had problems with web files containing a BOM, but it was some years ago and I cannot remember the details. Today I tried a test page encoded as UTF-8 with BOM on all the live web servers I currently use and on my test web server - no problems that I could see.Fruity
It looks like it will be OK to live with this - neither reverting to the 2012 version of VSEW nor switching to a different IDE is at all attractive. In the short term there will be a mix of files with and without a BOM. I hope this does not cause a problem with TFS source code control/comparisons. (WinDiff shows a difference when the only difference is the BOM; DiffMerge ignores the BOM.)Fruity
T
0

You can install Fix File Encoding for VS2013. According to the site, it "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."

It worked just fine to me. Hope it helps.

Teem answered 13/1, 2014 at 15:5 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.