summaryrefslogtreecommitdiffstats
path: root/winsup/utils/passwd.c
diff options
context:
space:
mode:
Diffstat (limited to 'winsup/utils/passwd.c')
-rw-r--r--winsup/utils/passwd.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/winsup/utils/passwd.c b/winsup/utils/passwd.c
index 3ea91a4e5..188f39f17 100644
--- a/winsup/utils/passwd.c
+++ b/winsup/utils/passwd.c
@@ -408,8 +408,10 @@ main (int argc, char **argv)
if (c)
*c = '\0';
- setlocale (LC_ALL, "");
-
+ /* Use locale from environment. If not set or set to "C", use UTF-8. */
+ setlocale (LC_CTYPE, "");
+ if (!strcmp (setlocale (LC_CTYPE, NULL), "C"))
+ setlocale (LC_CTYPE, "en_US.UTF-8");
while ((opt = getopt_long (argc, argv, opts, longopts, NULL)) != EOF)
switch (opt)
{