Set locale globally.
This commit is contained in:
parent
7bfb3c7e07
commit
f94d6a2229
18
src/adoc.cpp
18
src/adoc.cpp
|
@ -124,20 +124,14 @@ void export_adoc(const vector<Database::entry> &entries, ostream &out)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ // Sort by tag names otherwise.
|
{ // Sort by tag names otherwise.
|
||||||
std::locale loc("");
|
std::locale loc;
|
||||||
const std::collate<char> &coll =
|
const std::collate<char> &coll =
|
||||||
std::use_facet<std::collate<char>>(loc);
|
std::use_facet<std::collate<char>>(loc);
|
||||||
if (coll.compare(a.first.data(), a.first.data()
|
return (coll.compare(
|
||||||
+ a.first.length(),
|
a.first.data(), a.first.data()
|
||||||
b.first.data(), b.first.data()
|
+ a.first.length(),
|
||||||
+ b.first.length()) == -1)
|
b.first.data(), b.first.data()
|
||||||
{ // -1 == less than
|
+ b.first.length()) == -1);
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
#include <locale>
|
||||||
#include "sqlite.hpp"
|
#include "sqlite.hpp"
|
||||||
#include "parse_options.hpp"
|
#include "parse_options.hpp"
|
||||||
#include "uri.hpp"
|
#include "uri.hpp"
|
||||||
|
@ -33,6 +34,8 @@ using std::chrono::system_clock;
|
||||||
|
|
||||||
int main(const int argc, const char *argv[])
|
int main(const int argc, const char *argv[])
|
||||||
{
|
{
|
||||||
|
std::locale::global(std::locale("")); // Set locale globally.
|
||||||
|
|
||||||
options opts = parse_options(argc, argv);
|
options opts = parse_options(argc, argv);
|
||||||
if (opts.status_code != 0)
|
if (opts.status_code != 0)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue