aboutsummaryrefslogtreecommitdiff
path: root/src/util.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/util.cpp')
-rw-r--r--src/util.cpp36
1 files changed, 16 insertions, 20 deletions
diff --git a/src/util.cpp b/src/util.cpp
index 00e29446d5..aa3adf89ec 100644
--- a/src/util.cpp
+++ b/src/util.cpp
@@ -303,26 +303,6 @@ int LogPrintStr(const std::string &str)
return ret;
}
-void ParseString(const string& str, char c, vector<string>& v)
-{
- if (str.empty())
- return;
- string::size_type i1 = 0;
- string::size_type i2;
- while (true)
- {
- i2 = str.find(c, i1);
- if (i2 == str.npos)
- {
- v.push_back(str.substr(i1));
- return;
- }
- v.push_back(str.substr(i1, i2-i1));
- i1 = i2+1;
- }
-}
-
-
string FormatMoney(int64_t n, bool fPlus)
{
// Note: not using straight sprintf here because we do NOT want
@@ -1404,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
+}