In visual studio C++ 2013 express it seems that unless utf8-encoded file has BOM mark, compiler fails to understand that the file being compiled is in UTF8 encoding and trea
If your system locale is not English (E.g. Chinese or other language), a simple way to fix this is to change your system setting of 'Region and Language' to be English. Just follow steps below:
Control Panel -> Clock,Language,and Region -> Region and Language ->
Administrative -> Language for non-Unicode programs -> Change system locale.
Is that simple? It fixes my problem as my system locale is Chinese. The description of 'Language for non-Unicode programs' is clear:
This setting (system locale) controls the language used when displaying
text in programs that do not support Unicode.
More details in the image
I met this problem when I tried to build my project on Windows, which is successful on another Windows machine. I was crazy to modify all non-Unicode characters (All of then are comments) and so that compiler could move on. But there are too many files with this problem.