Unfortually a fallback to “C” locale via std::locale::global does not cover all scenarios with messed up environment locale settings and on Ubuntu 14.01 (with LANG=en_US.UTF-8, LANGUAGE=en_US, LC_* empty) setting LANG=invalid triggers a crash right at the start of bitcoind and bitcoin-qt.
This also affects test_bitcoin and test_bitcoin-qt, which were not guarded at all.
The PR expands the scope of the locale fallback and prevents crashes due to invalid locale settings of bitcoind, bitcoin-qt, test_bitcoin and test_bitcoin-qt. I didn’t want to create a seperate PR for the 0.10 branch, but a conflict free version is available: https://github.com/bitcoin/bitcoin/compare/0.10...dexX7:0.10-init-locale-fallback-tests-fix