From 3850d0505fb4350dccdd63cf6129db40fe9b5bd0 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Fri, 28 Aug 2015 13:38:49 +0200 Subject: build-sys: add missing Makefile symlink --- src/shared/Makefile | 1 + 1 file changed, 1 insertion(+) create mode 120000 src/shared/Makefile (limited to 'src/shared') diff --git a/src/shared/Makefile b/src/shared/Makefile new file mode 120000 index 0000000000..d0b0e8e008 --- /dev/null +++ b/src/shared/Makefile @@ -0,0 +1 @@ +../Makefile \ No newline at end of file -- cgit v1.2.3-54-g00ecf From a1b4e6e93396c1c449aac4a2a1847033b8ce59f4 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Fri, 28 Aug 2015 18:17:14 +0200 Subject: pager: set $LESSCHARSET when we output UTF8 chars This way we can be sure that less has the same idea of the terminal as we do. This solves issues in systems that have locale uninitalized, where systemd would output UTF-8 but less wouldn't allow it and show them as control characters. --- src/shared/pager.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src/shared') diff --git a/src/shared/pager.c b/src/shared/pager.c index 85f8fa5b39..3992f9c837 100644 --- a/src/shared/pager.c +++ b/src/shared/pager.c @@ -82,7 +82,7 @@ int pager_open(bool jump_to_end) { /* In the child start the pager */ if (pager_pid == 0) { - const char* less_opts; + const char* less_opts, *less_charset; (void) reset_all_signal_handlers(); (void) reset_signal_mask(); @@ -90,6 +90,7 @@ int pager_open(bool jump_to_end) { dup2(fd[0], STDIN_FILENO); safe_close_pair(fd); + /* Initialize a good set of less options */ less_opts = getenv("SYSTEMD_LESS"); if (!less_opts) less_opts = "FRSXMK"; @@ -97,6 +98,15 @@ int pager_open(bool jump_to_end) { less_opts = strjoina(less_opts, " +G"); setenv("LESS", less_opts, 1); + /* Initialize a good charset for less. This is + * particularly important if we output UTF-8 + * characters. */ + less_charset = getenv("SYSTEMD_LESSCHARSET"); + if (!less_charset && is_locale_utf8()) + less_charset = "utf-8"; + if (less_charset) + setenv("LESSCHARSET", less_charset, 1); + /* Make sure the pager goes away when the parent dies */ if (prctl(PR_SET_PDEATHSIG, SIGTERM) < 0) _exit(EXIT_FAILURE); -- cgit v1.2.3-54-g00ecf