'Why executing std::setlocale(LC_ALL, "C") at startup?

Cppreference.com says:

During program startup, the equivalent of std::setlocale(LC_ALL, "C"); is executed before any user code is run.

Calling std::setlocale(LC_ALL, "C"); sets the current locale to "C": basically a special, minimalistic locale where strings are seen as simple chunk of bytes, no knowledge of characters and so on.

This obviously affects how locale-dependent functions work (e.g. fprintf, tolower, ...). Why is that? Should I revert the locale to something else if I want to work with UTF-8 strings in my program?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source