aboutsummaryrefslogtreecommitdiff
path: root/src/util.cpp
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2014-05-19 15:08:28 +0200
committerWladimir J. van der Laan <laanwj@gmail.com>2014-05-19 15:08:48 +0200
commitc26acfc308482bac901ab3c7368c951514f13429 (patch)
tree2d5b257643abc48899eb9b4a315a3de375cadc99 /src/util.cpp
parenta99f9be0ebd4062fd73648d525b2c7961f845580 (diff)
parent5248ff40997c64cc0fde7aaa67cf94dd38b14899 (diff)
Merge pull request #4174
5248ff4 SetupEnvironment() - clean commit (Stuart Cardall)
Diffstat (limited to 'src/util.cpp')
-rw-r--r--src/util.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/util.cpp b/src/util.cpp
index 205af738d5..aa3adf89ec 100644
--- a/src/util.cpp
+++ b/src/util.cpp
@@ -1384,3 +1384,19 @@ bool ParseInt32(const std::string& str, int32_t *out)
n <= std::numeric_limits<int32_t>::max();
}
+void SetupEnvironment()
+{
+ #ifndef WIN32
+ try
+ {
+ #if BOOST_FILESYSTEM_VERSION == 3
+ boost::filesystem::path::codecvt(); // Raises runtime error if current locale is invalid
+ #else // boost filesystem v2
+ std::locale(); // Raises runtime error if current locale is invalid
+ #endif
+ } catch(std::runtime_error &e)
+ {
+ setenv("LC_ALL", "C", 1); // Force C locale
+ }
+ #endif
+}