From: Lennart Poettering Date: Wed, 12 Sep 2012 07:23:38 +0000 (+0200) Subject: journalctl: print QR code only if we are running on an UTF-8 system X-Git-Tag: v190~121 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=cf5a3432117cfbe4249919d2e947295aa19879d3;p=thirdparty%2Fsystemd.git journalctl: print QR code only if we are running on an UTF-8 system --- diff --git a/src/journal/journalctl.c b/src/journal/journalctl.c index e2600542fc7..8e52dd522b9 100644 --- a/src/journal/journalctl.c +++ b/src/journal/journalctl.c @@ -32,6 +32,8 @@ #include #include #include +#include +#include #include @@ -634,8 +636,13 @@ static int setup_keys(void) { fprintf(stderr, "\nThe keys have been generated for host " SD_ID128_FORMAT_STR ".\n", SD_ID128_FORMAT_VAL(machine)); #ifdef HAVE_QRENCODE - fprintf(stderr, "\nTo transfer the verification key to your phone please scan the QR code below:\n\n"); - print_qr_code(stderr, seed, seed_size, n, arg_interval, hn, machine); + /* If this is not an UTF-8 system don't print any QR codes */ + setlocale(LC_CTYPE, ""); + + if (streq_ptr(nl_langinfo(CODESET), "UTF-8")) { + fputs("\nTo transfer the verification key to your phone please scan the QR code below:\n\n", stderr); + print_qr_code(stderr, seed, seed_size, n, arg_interval, hn, machine); + } #endif free(hn); }