aboutsummaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2020-12-06 00:02:46 -0600
committerRob Landley <rob@landley.net>2020-12-06 00:02:46 -0600
commit75b89012c90470a27d66b54ad89901b94fcfd169 (patch)
tree07c1b6954a186511f016ca490c71ae0fbd2873f3 /main.c
parent0e675d98f3aba7a834dc56c2ae419f20da376f44 (diff)
downloadtoybox-75b89012c90470a27d66b54ad89901b94fcfd169.tar.gz
Remove CONFIG_TOYBOX_I18N and just always support utf8.
Diffstat (limited to 'main.c')
-rw-r--r--main.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/main.c b/main.c
index 7c60bdf4..25e4c472 100644
--- a/main.c
+++ b/main.c
@@ -98,11 +98,10 @@ void toy_singleinit(struct toy_list *which, char *argv[])
if (!(which->flags & TOYFLAG_NOFORK)) {
toys.old_umask = umask(0);
if (!(which->flags & TOYFLAG_UMASK)) umask(toys.old_umask);
- 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, "");
- }
+
+ // Try user's locale, falling back to C.UTF-8
+ setlocale(LC_CTYPE, "");
+ if (!strcmp("UTF-8", nl_langinfo(CODESET))) setlocale(LC_CTYPE, "C.UTF-8");
setlinebuf(stdout);
}
}