How to compile the source text to UTF-8 without BOM in Visual Studio?

Project source code is stored in UTF-8 format without BOM. When you build the project in Visual Studio there is the problem of displaying UTF, like other encoding. When you save source files in UTF-8 with BOM, the problem of character display disappears.
You must keep the source code format without BOM, how do you make cl.exe to accept UTF-8 without BOM as uniatowski?
September 18th 19 at 23:53
2 answers
September 18th 19 at 23:55
A philosophical reply from TO: store localizable resources separately from the code (in an. rc file or something like that). Trifle (individual characters) specify using escape sequences.
Remains the problem with the review (will be gibberish), but to come out properly.
I'm also thinking about localized resources. But with the review problems should not be, because the difference between utf formats with no signature and only in the presence of this signature, so all characters of the file will remain unchanged. - hailee_Parker26 commented on September 18th 19 at 23:58
: without signature Studio will recognize the file as ANSI, so instead of a review will be garbage. When you save (also ANSI), they will remain unchanged (and in the future will be a normally open editors that understand UTF-8 without BOM). The only problem is that in the Studio they will be unreadable. - marianne.Schulist commented on September 19th 19 at 00:01
September 18th 19 at 23:57
According to official documents is currently supported three formats of the source files: utf16 bom, utf16 w/o bom, the utf8 bom.
Unfortunately, utf8 w/o bom is not supported.
For myself, I found a few spike solutions:
- To do pre build script for converting files to utf8 bom and post build script to convert files to utf8 w/o bom
- Make the automatic conversion of the file as utf8 in visual studio. If you are using a version control system (like me, for example), then do pre-commit hook to convert to utf8 w/o bom
Are there any more opinions on the sequel?

Find more questions by tags UnicodeVisual Studio