Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

/utf-8 (Set Source and Executable character sets to UTF-8)

Visual Studio 2015
 

The latest version of this topic can be found at -utf-8 (Set Source and Executable character sets to UTF-8).

Specifies both the source character set and the execution character set as UTF-8.

/utf-8  

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. For a list of supported code page identifiers and character set names, see Code Page Identifiers.

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.

To set this compiler option in the Visual Studio development environment

  1. Open the project Property Pages dialog box. For more information, see How to: Open Project Property Pages.

  2. Expand the Configuration Properties, C/C++, Command Line folder.

  3. In Advanced Options, add the /utf-8 option, and specify your preferred encoding.

  4. Choose OK to save your changes.

Compiler Options
Setting Compiler Options
/execution-charset (Set Execution Character Set)
/source-charset (Set Source Character Set)
/validate-charset (Validate for compatible characters)

Show: