mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 20:12:57 +01:00
Merge #17085: init: Change fallback locale to C.UTF-8
facb9a1315f97489a20eb0e969fdb14b5128ed2f init: Change fallback locale to C.UTF-8 (Wladimir J. van der Laan) Pull request description: Much of our code assumes file system UTF-8 support, and this is a more realistic guess for modern systems anyway than the default character set (which would be ASCII only). So change the assumed fallback locale (if no locale is defined by the user or OS) to `C.UTF-8`. related: https://github.com/bitcoin/bitcoin/issues/14948#issuecomment-488385462 ACKs for top commit: MarcoFalke: ACK facb9a1315f97489a20eb0e969fdb14b5128ed2f Tree-SHA512: 5075f9fe6791572d76ec38c58cd56f04ed8086c06a7d7f446d062dffc313c62466ba81f1a7d6b8c7e95791fcff82e4f76871c3534478fbfe5beb456dd8eea340
This commit is contained in:
parent
c79a03ec93
commit
e4457ce2ef
@ -1266,12 +1266,12 @@ void SetupEnvironment()
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
// On most POSIX systems (e.g. Linux, but not BSD) the environment's locale
|
// On most POSIX systems (e.g. Linux, but not BSD) the environment's locale
|
||||||
// may be invalid, in which case the "C" locale is used as fallback.
|
// may be invalid, in which case the "C.UTF-8" locale is used as fallback.
|
||||||
#if !defined(WIN32) && !defined(MAC_OSX) && !defined(__FreeBSD__) && !defined(__OpenBSD__)
|
#if !defined(WIN32) && !defined(MAC_OSX) && !defined(__FreeBSD__) && !defined(__OpenBSD__)
|
||||||
try {
|
try {
|
||||||
std::locale(""); // Raises a runtime error if current locale is invalid
|
std::locale(""); // Raises a runtime error if current locale is invalid
|
||||||
} catch (const std::runtime_error&) {
|
} catch (const std::runtime_error&) {
|
||||||
setenv("LC_ALL", "C", 1);
|
setenv("LC_ALL", "C.UTF-8", 1);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
// The path locale is lazy initialized and to avoid deinitialization errors
|
// The path locale is lazy initialized and to avoid deinitialization errors
|
||||||
|
Loading…
Reference in New Issue
Block a user