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
Update to Visual Studio 2015. It supports new compiler options for source and execution characters sets.
You can use the
/utf-8
option to specify both the source and execution character sets as encoded by using UTF-8. It is equivalent to specifying/source-charset:utf-8 /execution-charset:utf-8
on the command line. Any of these options also enables the/validate-charset
option by default....By default, Visual Studio detects a byte-order mark to determine if the source file is in an encoded Unicode format, for example, UTF-16 or UTF-8. If no byte-order mark is found, it assumes the source file is encoded using the current user code page, unless you have specified a code page by using
/utf-8
or the/source-charset
option. Visual Studio allows you to save your C++ source code by using any of several character encodings....
Ref: https://msdn.microsoft.com/en-us/library/mt708821.aspx