Skip to content

Commit ba46f39

Browse files
laanwjfanquake
authored andcommitted
init: Change fallback locale to C.UTF-8
Much of our code assumes 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`. Github-Pull: bitcoin#17085 Rebased-From: facb9a1
1 parent 3834d3d commit ba46f39

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/util/system.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -1153,12 +1153,12 @@ void SetupEnvironment()
11531153
}
11541154
#endif
11551155
// On most POSIX systems (e.g. Linux, but not BSD) the environment's locale
1156-
// may be invalid, in which case the "C" locale is used as fallback.
1156+
// may be invalid, in which case the "C.UTF-8" locale is used as fallback.
11571157
#if !defined(WIN32) && !defined(MAC_OSX) && !defined(__FreeBSD__) && !defined(__OpenBSD__)
11581158
try {
11591159
std::locale(""); // Raises a runtime error if current locale is invalid
11601160
} catch (const std::runtime_error&) {
1161-
setenv("LC_ALL", "C", 1);
1161+
setenv("LC_ALL", "C.UTF-8", 1);
11621162
}
11631163
#elif defined(WIN32)
11641164
// Set the default input/output charset is utf-8

0 commit comments

Comments
 (0)