std::text_encoding::environment

Constructs a new text_encoding object representing the environment encoding that refers to the implementation-defined character encoding scheme of the execution environment. The execution environment at runtime is the environment in which the program is run.

# Declarations

static text_encoding environment();

(since C++26)

# Return value

The object holding the representation of the environment character encoding.

# Notes

The environment encoding may differ from the global locale-associated encoding that is accessible via std::locale().encoding().

On Windows platforms, the environment encoding can be determined by GetACP() and then mapped to MIBenum values.

On POSIX platforms, the environment encoding is associated with the POSIX locale "" which can be implemented to correspond to a value of nl_langinfo_l() when the environment locale "" is set before the global C++ locale is set to “C” at program startup.

# Example

This section is incompleteReason: no example

# See also