diff options
author | Simon McVittie <smcv@debian.org> | 2016-01-21 07:25:25 +0000 |
---|---|---|
committer | Simon McVittie <smcv@debian.org> | 2016-01-21 07:33:41 +0000 |
commit | b8dbb48fdce9ffc00d1f3f4267948ee2875d2970 (patch) | |
tree | 52851586913097cfd80f4b2a7f169cf695f408b9 | |
parent | a8951de19eff73dc3d2e1d1b20518ecb56133184 (diff) | |
download | ikiwiki-b8dbb48fdce9ffc00d1f3f4267948ee2875d2970.tar ikiwiki-b8dbb48fdce9ffc00d1f3f4267948ee2875d2970.tar.gz |
Force log messages to be bytestrings
Sys::Syslog is not UTF-8-literate.
-rw-r--r-- | IkiWiki.pm | 4 | ||||
-rwxr-xr-x | t/syslog.t | 2 |
2 files changed, 4 insertions, 2 deletions
diff --git a/IkiWiki.pm b/IkiWiki.pm index fe5af6d15..97fe6b8ff 100644 --- a/IkiWiki.pm +++ b/IkiWiki.pm @@ -846,7 +846,9 @@ sub log_message ($$) { # keep a copy to avoid editing the original config repeatedly my $wikiname = $config{wikiname}; utf8::encode($wikiname); - Sys::Syslog::syslog($type, "[$wikiname] %s", join(" ", @_)); + my $message = join(" ", @_); + utf8::encode($message); + Sys::Syslog::syslog($type, "[$wikiname] %s", $message); }; if ($@) { print STDERR "failed to syslog: $@" unless $log_failed; diff --git a/t/syslog.t b/t/syslog.t index ffe8635b3..d5c1bc56b 100755 --- a/t/syslog.t +++ b/t/syslog.t @@ -12,7 +12,7 @@ $IkiWiki::config{syslog} = 1; $IkiWiki::config{wikiname} = 'ASCII'; is(debug('test'), '', 'plain ASCII syslog'); $IkiWiki::config{wikiname} = 'not ⒶSCII'; -is(debug('test'), '', 'UTF8 syslog'); +is(debug('𝗧ĕṡҭ'), '', 'UTF8 syslog'); my $orig = $IkiWiki::config{wikiname}; is(debug('test'), '', 'check for idempotency'); is($IkiWiki::config{wikiname}, $orig, 'unchanged config'); |