summaryrefslogtreecommitdiff
path: root/apt-pkg/contrib/strutl.cc
diff options
context:
space:
mode:
authorJulian Andres Klode <jak@debian.org>2016-08-23 20:19:11 +0200
committerJulian Andres Klode <jak@debian.org>2016-11-14 15:10:03 +0100
commit50e3f7d4b7388d261e79e5d022a26262e7e72118 (patch)
tree9807d10e78a77a27745c611cbe3b66f0721fcaf2 /apt-pkg/contrib/strutl.cc
parent330f9fcd988e46de8e6f1d44660d6dea0b47a8df (diff)
Use C locale instead of C.UTF-8 for protocol strings
The C.UTF-8 locale is not portable, so we need to use C, otherwise we crash on other systems. We can use std::locale::classic() for that, which might also be a bit cheaper than using locale("C"). (cherry picked from commit 0fb16c3e678044d6d06ba8a6199b1e96487ee0d8)
Diffstat (limited to 'apt-pkg/contrib/strutl.cc')
-rw-r--r--apt-pkg/contrib/strutl.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/apt-pkg/contrib/strutl.cc b/apt-pkg/contrib/strutl.cc
index ca924e578..61a86a479 100644
--- a/apt-pkg/contrib/strutl.cc
+++ b/apt-pkg/contrib/strutl.cc
@@ -754,7 +754,7 @@ string TimeRFC1123(time_t Date)
if (gmtime_r(&Date, &Conv) == NULL)
return "";
- auto const posix = std::locale("C.UTF-8");
+ auto const posix = std::locale::classic();
std::ostringstream datestr;
datestr.imbue(posix);
datestr << std::put_time(&Conv, "%a, %d %b %Y %H:%M:%S GMT");
@@ -934,7 +934,7 @@ bool RFC1123StrToTime(const char* const str,time_t &time)
signed int year = 0; // yes, Y23K problem – we gonna worry then…
std::string weekday, month, datespec, timespec, zone;
std::istringstream ss(str);
- auto const &posix = std::locale("C.UTF-8");
+ auto const &posix = std::locale::classic();
ss.imbue(posix);
ss >> weekday;
// we only superficially check weekday, mostly to avoid accepting localized