3

Is there a way to force Visual Studio to automatically save (and generate) files using UTF-8 without signature?

Here is why I ask, when I use VS to apply a XSLT, it auto-saves the files and it includes the dreaded BOM. That is no big deal, but since I'm generating XHTML, it gives me a warning everytime one of those files go into the validator.

Luiz Borges
  • 537
  • 1
  • 5
  • 19
  • possible duplicate of [utf-8 without BOM in visual studio 2010](http://stackoverflow.com/questions/5406172/utf-8-without-bom-in-visual-studio-2010) – CharlesB Dec 19 '11 at 23:13
  • Also possible duplicate of [Force Visual Studio (2010) to save all files in UTF-8](http://stackoverflow.com/questions/1838899/force-visual-studio-2010-to-save-all-files-in-utf-8) – Matt Sach Jul 17 '12 at 13:39

1 Answers1

1

I don't think so. see the comments for correction.

Also Microsoft's compilers, cl.exe at least, don't handle UTF-8 files without a UTF-8 signature correctly. For example, in a files saved as UTF-8 without a signature, if you have a string literal or wide string literal that contains characters above U+007F those characters will be converted to the execution or wide execution charset by erroneously assuming that the source encoding is the ansi codepage set for non-Unicode programs. That is, even though the Visual Studio project knows the encoding is UTF-8 and can display it correctly, the compiler will treat it as something else.

bames53
  • 86,085
  • 15
  • 179
  • 244
  • Thanks for the clarification, actually you can make the change I asked for based on this answer http://stackoverflow.com/questions/5406172/utf-8-without-bom-in-visual-studio-2010 but only in VS2010 (not on Visual Express). Also, since I'm working with other languages besides english I might have problems with encoding, so I'm leaving it as it is for now. – Luiz Borges Dec 21 '11 at 10:40
  • FYI, here is bug report about using UTF-8 encoded files without BOM: https://connect.microsoft.com/VisualStudio/feedback/details/888437/it-is-impossible-to-use-utf-8-without-bom-in-source-files . MS's resolution as usual: Won't Fix. – rutsky Jul 17 '14 at 15:23