From 2c3eade704f63b360926de9e975ce80143781679 Mon Sep 17 00:00:00 2001 From: Chun Kuan Lee Date: Sat, 4 Aug 2018 16:39:14 +0000 Subject: Make fs::path::string() always return utf-8 string --- src/fs.h | 1 - src/qt/guiutil.cpp | 6 ++---- src/util.cpp | 4 ++++ 3 files changed, 6 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/fs.h b/src/fs.h index 5492bdd4ec..a7074f446a 100644 --- a/src/fs.h +++ b/src/fs.h @@ -10,7 +10,6 @@ #include #include -#include /** Filesystem operations and types */ namespace fs = boost::filesystem; diff --git a/src/qt/guiutil.cpp b/src/qt/guiutil.cpp index 7afe25d25a..b894fc8166 100644 --- a/src/qt/guiutil.cpp +++ b/src/qt/guiutil.cpp @@ -60,8 +60,6 @@ #include #endif -static fs::detail::utf8_codecvt_facet utf8; - namespace GUIUtil { QString dateTimeStr(const QDateTime &date) @@ -764,12 +762,12 @@ void setClipboard(const QString& str) fs::path qstringToBoostPath(const QString &path) { - return fs::path(path.toStdString(), utf8); + return fs::path(path.toStdString()); } QString boostPathToQString(const fs::path &path) { - return QString::fromStdString(path.string(utf8)); + return QString::fromStdString(path.string()); } QString formatDurationStr(int secs) diff --git a/src/util.cpp b/src/util.cpp index 75a387d7ec..fa624aee90 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -1206,7 +1206,11 @@ void SetupEnvironment() // A dummy locale is used to extract the internal default locale, used by // fs::path, which is then used to explicitly imbue the path. std::locale loc = fs::path::imbue(std::locale::classic()); +#ifndef WIN32 fs::path::imbue(loc); +#else + fs::path::imbue(std::locale(loc, new std::codecvt_utf8_utf16())); +#endif } bool SetupNetworking() -- cgit v1.2.3