SimpCfg: As locale manipulation reqd for better processing
This commit is contained in:
parent
2325764180
commit
d1156cc055
1 changed files with 13 additions and 4 deletions
|
@ -260,6 +260,16 @@ public:
|
||||||
return array;
|
return array;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void locale_prepare(std::string &sSavedLocale) {
|
||||||
|
sSavedLocale = std::setlocale(LC_ALL, nullptr);
|
||||||
|
auto sUpdatedLocale = std::setlocale(LC_ALL, "en_US.UTF-8");
|
||||||
|
LDBUG_LN("DBUG:%s:Locale:Prev:%s:Cur:%s", __func__, sSavedLocale.c_str(), sUpdatedLocale);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void locale_restore(const std::string &sSavedLocale) {
|
||||||
|
auto sCurLocale = std::setlocale(LC_ALL, sSavedLocale.c_str());
|
||||||
|
LDBUG_LN("DBUG:%s:Locale:Requested:%s:Got:%s", __func__, sSavedLocale.c_str(), sCurLocale);
|
||||||
|
}
|
||||||
|
|
||||||
void load(const std::string &fname) {
|
void load(const std::string &fname) {
|
||||||
std::ifstream f {fname};
|
std::ifstream f {fname};
|
||||||
|
@ -397,14 +407,13 @@ void check_wstring_cout() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void check_strings() {
|
void check_strings() {
|
||||||
std::string prevLoc = std::setlocale(LC_ALL, nullptr);
|
std::string sSavedLocale;
|
||||||
LDBUG_LN("DBUG:%s:Locale:%s", __func__, prevLoc.c_str());
|
SimpCfg::locale_prepare(sSavedLocale);
|
||||||
prevLoc = std::setlocale(LC_ALL, "en_US.UTF-8");
|
|
||||||
LDBUG_LN("DBUG:%s:Locale:%s", __func__, prevLoc.c_str());
|
|
||||||
check_string();
|
check_string();
|
||||||
check_u8string();
|
check_u8string();
|
||||||
//check_wstring_wcout();
|
//check_wstring_wcout();
|
||||||
check_wstring_cout();
|
check_wstring_cout();
|
||||||
|
SimpCfg::locale_restore(sSavedLocale);
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char **argv) {
|
int main(int argc, char **argv) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue