Skip to content

Commit 7fb3cd6

Browse files
laanwjPastaPastaPasta
authored andcommitted
Merge bitcoin#17085: init: Change fallback locale to C.UTF-8
facb9a1 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: bitcoin#14948 (comment) ACKs for top commit: MarcoFalke: ACK facb9a1 Tree-SHA512: 5075f9fe6791572d76ec38c58cd56f04ed8086c06a7d7f446d062dffc313c62466ba81f1a7d6b8c7e95791fcff82e4f76871c3534478fbfe5beb456dd8eea340
1 parent 2b3090e commit 7fb3cd6

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/util.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -1147,12 +1147,12 @@ void SetupEnvironment()
11471147
}
11481148
#endif
11491149
// On most POSIX systems (e.g. Linux, but not BSD) the environment's locale
1150-
// may be invalid, in which case the "C" locale is used as fallback.
1150+
// may be invalid, in which case the "C.UTF-8" locale is used as fallback.
11511151
#if !defined(WIN32) && !defined(MAC_OSX) && !defined(__FreeBSD__) && !defined(__OpenBSD__)
11521152
try {
11531153
std::locale(""); // Raises a runtime error if current locale is invalid
11541154
} catch (const std::runtime_error&) {
1155-
setenv("LC_ALL", "C", 1);
1155+
setenv("LC_ALL", "C.UTF-8", 1);
11561156
}
11571157
#endif
11581158
// The path locale is lazy initialized and to avoid deinitialization errors

0 commit comments

Comments
 (0)