summaryrefslogtreecommitdiff
path: root/src/shared/util.c
diff options
context:
space:
mode:
authorHarald Hoyer <harald@redhat.com>2013-04-15 18:34:53 +0200
committerHarald Hoyer <harald@redhat.com>2013-04-15 18:37:24 +0200
commitfee79e010f1f8ad2bce6b41c67e8ddd4f419ff4b (patch)
tree252548b3213c05fdcfb0594c2bf5f7f718003184 /src/shared/util.c
parentab06eef8101866dd1337c4759002f7360a9db416 (diff)
do not change console to non-unicode for LANG=C
If systemd-vconsole-setup was started with LANG=C (no locale.conf), then it would set the console to non-unicode, which is not what we want.
Diffstat (limited to 'src/shared/util.c')
-rw-r--r--src/shared/util.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/shared/util.c b/src/shared/util.c
index 5827f6c7a1..5d6995d23f 100644
--- a/src/shared/util.c
+++ b/src/shared/util.c
@@ -5402,7 +5402,23 @@ bool is_locale_utf8(void) {
goto out;
}
- cached_answer = streq(set, "UTF-8");
+ if(streq(set, "UTF-8")) {
+ cached_answer = true;
+ goto out;
+ }
+
+ /* For LC_CTYPE=="C" return true,
+ * because CTYPE is effectly unset and
+ * everything defaults to UTF-8 nowadays. */
+
+ set = setlocale(LC_CTYPE, NULL);
+ if (!set) {
+ cached_answer = true;
+ goto out;
+ }
+
+ cached_answer = streq(set, "C");
+
out:
return (bool)cached_answer;
}