What is MSVC’s default execution character set?

Jayman 110 Reputation points
2024-07-09T23:31:29.6366667+00:00

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.

C++
C++
A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
3,633 questions
0 comments No comments
{count} votes

Accepted answer
  1. RLWA32 43,146 Reputation points
    2024-07-10T01:13:40.7333333+00:00

    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."

    1 person found this answer helpful.
    0 comments No comments

0 additional answers

Sort by: Most helpful