warning c4819 in Visual Studio C++ 2013 express - utf8 files without bom

后端 未结 4 1134
慢半拍i
慢半拍i 2021-01-03 03:39

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

4条回答
  •  半阙折子戏
    2021-01-03 03:48

    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

提交回复
热议问题