--- namecoin-nc*/src/init.cpp +++ namecoin-nc*/src/init.cpp @@ -99,6 +99,10 @@ #ifndef GUI int main(int argc, char* argv[]) { + #ifndef WIN32 + SetupEnvironment(); + #endif + bool fRet = false; fRet = AppInit(argc, argv); --- namecoin-nc*/src/qt/bitcoin.cpp +++ namecoin-nc*/src/qt/bitcoin.cpp @@ -124,6 +124,10 @@ #ifndef BITCOIN_QT_TEST int main(int argc, char *argv[]) { + #ifndef WIN32 + SetupEnvironment(); + #endif + // Command-line options take precedence: ParseParameters(argc, argv); --- namecoin-nc*/src/util.cpp +++ namecoin-nc*/src/util.cpp @@ -1114,3 +1114,20 @@ } return true; } + +#ifndef WIN32 +void SetupEnvironment() +{ + 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 --- namecoin-nc0.3.76/src/util.h +++ namecoin-nc0.3.76/src.new/util.h @@ -211,6 +211,7 @@ void RandAddSeed(); void RandAddSeedPerfmon(); +void SetupEnvironment(); int OutputDebugStringF(const char* pszFormat, ...); int my_snprintf(char* buffer, size_t limit, const char* format, ...);