/validate-charset (Validate for compatible characters)
Validates that the source file text contains only characters representable as UTF-8.
You can use the /validate-charset option to validate that the source code contains only characters that can be represented in both the source character set and the execution character set. This check is enabled automatically when you specify /source-charset, /execution-charset, or /utf-8 compiler options. You can explicitly disable this check by specifying the /validate-charset- option.
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. For information about source and execution character sets, see Character Sets in the language documentation. For a list of supported code page identifiers and character set names, see Code Page Identifiers.
Visual Studio uses UTF-8 as the internal character encoding during conversion between the source character set and the execution character set. If a character in the source file cannot be represented in the execution character set, the UTF-8 conversion substitutes a question mark '?' character. The /validate-charset option causes the compilation to report a warning if this occurs.
To set this compiler option in the Visual Studio development environment
Open the project Property Pages dialog box. For more information, see Set C++ compiler and build properties in Visual Studio.
Expand the Configuration Properties, C/C++, Command Line folder.
In Additional Options, add the /validate-charset option, and specify your preferred encoding.
Choose OK to save your changes.
MSVC Compiler Options
MSVC Compiler Command-Line Syntax
/execution-charset (Set Execution Character Set)
/source-charset (Set Source Character Set)
/utf-8 (Set Source and Executable character sets to UTF-8)