Describe the bug
"Is there a way to make system_error to honor the current threads’s locale ?
This always prints an error-message according to my default locale."
Command-line test case
C:\Temp>type repro.cpp
#include <clocale>
#include <iostream>
#include <string>
#include <Windows.h>
int main() {
setlocale(LC_ALL, "");
SetThreadLocale(MAKELCID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), SORT_DEFAULT));
std::string errmsg = std::system_category().message(1);
std::cout << errmsg << '\n';
}
C:\Temp>cl /nologo /EHsc /W4 /WX repro.cpp
repro.cpp
C:\Temp>.\repro.exe
Неверная функция.
Expected behavior
The message should be in English. (My System Language is Russian)
The program should have a way to change locale of system_error
messages.
STL version
git commit hash: ef62d3f
Additional context
DevCom-10098476
Currently we use LOCALE_NAME_SYSTEM_DEFAULT
so we don't honor the current threads's locale.
We can't use GetThreadLocale because it doesn't work with UWP.Minimum supported client | Windows 2000 Professional [desktop apps only]
I recently changed the function but previous version didn't respect the current threads's locale either: https://godbolt.org/z/37f44nahM
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4