aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--main.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/main.c b/main.c
index e13b5c29..99c53f96 100644
--- a/main.c
+++ b/main.c
@@ -83,7 +83,11 @@ static void toy_singleinit(struct toy_list *which, char *argv[])
toys.which = which;
toys.argv = argv;
- if (CFG_TOYBOX_I18N) setlocale(LC_CTYPE, "C.UTF-8");
+ if (CFG_TOYBOX_I18N) {
+ // Deliberately try C.UTF-8 before the user's locale to work around users
+ // that choose non-UTF-8 locales. macOS doesn't support C.UTF-8 though.
+ if (!setlocale(LC_CTYPE, "C.UTF-8")) setlocale(LC_CTYPE, "");
+ }
setlinebuf(stdout);
// Parse --help and --version for (almost) all commands