chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
util.c:is_locale_utf8(): check, if "C" was set on purpose
[elogind.git]
/
src
/
shared
/
util.c
diff --git
a/src/shared/util.c
b/src/shared/util.c
index 19ca8ad1358f68f5733cdea1d1a9ec4855f122d2..15abd5046d72e160e1cbf6a25254c8ec16a17679 100644
(file)
--- a/
src/shared/util.c
+++ b/
src/shared/util.c
@@
-5420,20
+5420,24
@@
bool is_locale_utf8(void) {
goto out;
}
goto out;
}
- /* For LC_CTYPE=="C" return true,
- * because CTYPE is effectly unset and
- * everything defaults to UTF-8 nowadays. */
-
+ /* For LC_CTYPE=="C" return true, because CTYPE is effectly
+ * unset and everything can do to UTF-8 nowadays. */
set = setlocale(LC_CTYPE, NULL);
if (!set) {
cached_answer = true;
goto out;
}
set = setlocale(LC_CTYPE, NULL);
if (!set) {
cached_answer = true;
goto out;
}
- cached_answer = streq(set, "C");
+ /* Check result, but ignore the result if C was set
+ * explicitly. */
+ cached_answer =
+ streq(set, "C") &&
+ !getenv("LC_ALL") &&
+ !getenv("LC_CTYPE") &&
+ !getenv("LANG");
out:
out:
- return (bool)cached_answer;
+ return (bool)
cached_answer;
}
const char *draw_special_char(DrawSpecialChar ch) {
}
const char *draw_special_char(DrawSpecialChar ch) {