Forcing VS2010 to use UTF-8 without signature
Asked Answered
V

1

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.

Versieversification answered 19/12, 2011 at 20:36 Comment(2)
possible duplicate of utf-8 without BOM in visual studio 2010Hence
Also possible duplicate of Force Visual Studio (2010) to save all files in UTF-8Sperry
S
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.

Sepia answered 21/12, 2011 at 9:3 Comment(2)
Thanks for the clarification, actually you can make the change I asked for based on this answer #5406672 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.Versieversification
FYI, here is bug report about using UTF-8 encoded files without BOM: connect.microsoft.com/VisualStudio/feedback/details/888437/… . MS's resolution as usual: Won't Fix.Leonelleonelle

© 2022 - 2024 — McMap. All rights reserved.