aboutsummaryrefslogtreecommitdiffstats
path: root/testing/bitcoin/20-set-default-env.patch
blob: b9717abbc9485d9eb1d47d6de9e85094d0c199be (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
--- ./src/bitcoin-cli.cpp
+++ ./src/bitcoin-cli.cpp
@@ -53,6 +53,16 @@
 
 int main(int argc, char* argv[])
 {
+    #ifndef WIN32
+    try
+    {
+        boost::filesystem::path::codecvt(); // Raises runtime error if current locale is invalid
+    } catch(std::runtime_error &e)
+    {
+        setenv("LC_ALL", "C", 1); // Force C locale
+    }
+    #endif
+
     try
     {
         if(!AppInitRPC(argc, argv))
--- ./src/bitcoind.cpp
+++ ./src/bitcoind.cpp
@@ -166,6 +166,16 @@
 
 int main(int argc, char* argv[])
 {
+    #ifndef WIN32
+    try
+    {
+        boost::filesystem::path::codecvt(); // Raises runtime error if current locale is invalid
+    } catch(std::runtime_error &e)
+    {
+        setenv("LC_ALL", "C", 1); // Force C locale
+    }
+    #endif
+
     bool fRet = false;
 
     // Connect bitcoind signal handlers
--- ./src/qt/bitcoin.cpp.orig
+++ ./src/qt/bitcoin.cpp
@@ -445,6 +445,16 @@
 #ifndef BITCOIN_QT_TEST
 int main(int argc, char *argv[])
 {
+#ifndef WIN32
+    try
+    {
+        boost::filesystem::path::codecvt(); // Raises runtime error if current locale is invalid
+    } catch(std::runtime_error &e)
+    {
+        setenv("LC_ALL", "C", 1); // Force C locale
+    }
+#endif
+
     /// 1. Parse command-line options. These take precedence over anything else.
     // Command-line options take precedence:
     ParseParameters(argc, argv);