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").
HashStringList ServerHashes;
unsigned long long ServerSize = 0;
HashStringList ServerHashes;
unsigned long long ServerSize = 0;
- auto const &posix = std::locale("C.UTF-8");
+ auto const &posix = std::locale::classic();
for (char const * const * type = HashString::SupportedHashes(); *type != NULL; ++type)
{
std::string tagname = *type;
for (char const * const * type = HashString::SupportedHashes(); *type != NULL; ++type)
{
std::string tagname = *type;
// build the status str
std::ostringstream str;
// build the status str
std::ostringstream str;
- str.imbue(std::locale("C.UTF-8"));
+ str.imbue(std::locale::classic());
str.precision(4);
str << "dlstatus" << ':' << std::fixed << i << ':' << Percent << ':' << msg << '\n';
auto const dlstatus = str.str();
str.precision(4);
str << "dlstatus" << ':' << std::fixed << i << ':' << Percent << ':' << msg << '\n';
auto const dlstatus = str.str();
if (gmtime_r(&Date, &Conv) == NULL)
return "";
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);
APT::StringView const fmt("%a, %d %b %Y %H:%M:%S");
std::ostringstream datestr;
datestr.imbue(posix);
APT::StringView const fmt("%a, %d %b %Y %H:%M:%S");
signed int year = 0; // yes, Y23K problem – we gonna worry then…
std::string weekday, month, datespec, timespec, zone;
std::istringstream ss(str);
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
ss.imbue(posix);
ss >> weekday;
// we only superficially check weekday, mostly to avoid accepting localized
{
float const progress{Done / static_cast<float>(Total) * 100};
std::ostringstream str;
{
float const progress{Done / static_cast<float>(Total) * 100};
std::ostringstream str;
- str.imbue(std::locale("C.UTF-8"));
+ str.imbue(std::locale::classic());
str.precision(4);
str << status << ':' << pkg << ':' << std::fixed << progress << ':' << msg << '\n';
return str.str();
str.precision(4);
str << status << ':' << pkg << ':' << std::fixed << progress << ':' << msg << '\n';
return str.str();
{
float const progress{Done / static_cast<float>(Total) * 100};
std::ostringstream str;
{
float const progress{Done / static_cast<float>(Total) * 100};
std::ostringstream str;
- str.imbue(std::locale("C.UTF-8"));
+ str.imbue(std::locale::classic());
str.precision(4);
str << "Status: " << status << '\n';
if (pkg != nullptr)
str.precision(4);
str << "Status: " << status << '\n';
if (pkg != nullptr)