The documentation at execution_character_set pragma says "By default, when the compiler encodes narrow characters and narrow strings, it uses the current code page as the execution character set. Unicode or DBCS characters outside the range of the current code page get converted to the default replacement character in the output."
What is MSVC’s default execution character set?
According to MSVC’s documentation, I can use the /execution-charset
option to change which execution character set a program uses. Let’s say that I don’t use the /execution-charset
option. What execution character set will MSVC use by default?
The documentation for /execution-charset
says:
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 that the source file is encoded in the current user code page, unless you used the
/source-charset
or/utf-8
option to specify a character set name or code page. Visual Studio allows you to save your C++ source code in any of several character encodings. For information about source and execution character sets, see Character sets in the language documentation.
When I first read it, I thought that that paragraph answered my question, but after rereading it, I now think that that paragraph is a copy-paste error. That paragraph talks about the character encoding of source code files, but that’s different than the execution character set. If I wanted to adjust the character encoding of the source code files, then I would use the /source-charset
option.