diff --git a/include/stdex/chrono.hpp b/include/stdex/chrono.hpp index da0b30889..0dee95ac1 100644 --- a/include/stdex/chrono.hpp +++ b/include/stdex/chrono.hpp @@ -392,7 +392,7 @@ namespace stdex { template, class AX = std::allocator> static std::basic_string to_rfc822(_In_ const time_point tp) { - return to_str(tp, "%a, %d %b %Y %H:%M:%S GMT", locale_C.get()); + return to_str(tp, "%a, %d %b %Y %H:%M:%S GMT", stdex::locale_C); } }; } diff --git a/include/stdex/html.hpp b/include/stdex/html.hpp index ebe26998f..aebefd09e 100644 --- a/include/stdex/html.hpp +++ b/include/stdex/html.hpp @@ -1999,7 +1999,7 @@ namespace stdex { size_t n = str.size(); // Use %X instead of %p to ommit leading zeros and save space. - stdex::appendf(str, "%c%zX%c", stdex::locale_C.get(), token_tag_start, reinterpret_cast(this), token_tag_end); + stdex::appendf(str, "%c%zX%c", stdex::locale_C, token_tag_start, reinterpret_cast(this), token_tag_end); return str.size() - n; } @@ -2014,7 +2014,7 @@ namespace stdex size_t append_tag(_Inout_ std::basic_string& str) const { // Use %X instead of %p to ommit leading zeros and save space. - return stdex::appendf(str, L"%c%zX%c", stdex::locale_C.get(), static_cast(token_tag_start), reinterpret_cast(this), static_cast(token_tag_end)); + return stdex::appendf(str, L"%c%zX%c", stdex::locale_C, static_cast(token_tag_start), reinterpret_cast(this), static_cast(token_tag_end)); } template diff --git a/include/stdex/locale.hpp b/include/stdex/locale.hpp index 7b1da7909..b5a3f4f10 100644 --- a/include/stdex/locale.hpp +++ b/include/stdex/locale.hpp @@ -89,4 +89,24 @@ namespace stdex /// Reusable C-locale /// const inline locale locale_C(create_locale(LC_ALL, "C")); + + /// + /// Reusable UTF-8 locale + /// + const inline locale locale_utf8(create_locale(LC_ALL, ".UTF-8")); + + /// + /// Reusable default charset locale + /// + const inline locale locale_default(create_locale(LC_ALL, +#ifdef WIN32 +#ifdef _CONSOLE + ".OCP" +#else + ".ACP" +#endif +#else + "" +#endif + )); } \ No newline at end of file