From df4f8b0809c9e64a22343605934c6e3fd8672d0c Mon Sep 17 00:00:00 2001 From: levlam Date: Sat, 10 Feb 2018 00:52:03 +0300 Subject: [PATCH] Better locale changing. GitOrigin-RevId: 51700edad491f43264769b932961a3eae1c7fd34 --- td/telegram/cli.cpp | 6 +++--- tdutils/test/misc.cpp | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/td/telegram/cli.cpp b/td/telegram/cli.cpp index 543930e6..40697019 100644 --- a/td/telegram/cli.cpp +++ b/td/telegram/cli.cpp @@ -2957,9 +2957,9 @@ void main(int argc, char **argv) { set_signal_handler(SignalType::Abort, fail_signal).ensure(); td::Log::set_fatal_error_callback(on_fatal_error); - std::string locale_name = (std::setlocale(LC_ALL, "fr-FR") == nullptr ? "C" : "fr-FR"); - std::locale locale_fr(locale_name); - std::locale::global(locale_fr); + const char *locale_name = (std::setlocale(LC_ALL, "fr-FR") == nullptr ? "" : "fr-FR"); + std::locale new_locale(locale_name); + std::locale::global(new_locale); SCOPE_EXIT { std::locale::global(std::locale::classic()); }; diff --git a/tdutils/test/misc.cpp b/tdutils/test/misc.cpp index a5511d0e..952e7907 100644 --- a/tdutils/test/misc.cpp +++ b/tdutils/test/misc.cpp @@ -217,7 +217,7 @@ static void test_to_double() { TEST(Misc, to_double) { test_to_double(); - std::string locale_name = (std::setlocale(LC_ALL, "fr-FR") == nullptr ? "C" : "fr-FR"); + const char *locale_name = (std::setlocale(LC_ALL, "fr-FR") == nullptr ? "" : "fr-FR"); std::locale new_locale(locale_name); std::locale::global(new_locale); test_to_double();