use a fallback 8bit decoding for non-utf8 messages

master
Yves G 2018-02-02 13:41:59 +01:00 committed by Y
parent 9ddc8394d4
commit 6a5de578bb
1 changed files with 4 additions and 0 deletions

View File

@ -18,6 +18,7 @@ def _setPyrusePaths():
PYRUSE_PATHS.insert(0, os.curdir)
def _doForEachJournalEntry(workflow):
enc8b = config.Config().asMap().get("8bit-message-encoding", "iso-8859-1")
j = journal.Reader(journal.SYSTEM_ONLY)
j.seek_tail()
j.get_previous()
@ -25,6 +26,9 @@ def _doForEachJournalEntry(workflow):
event = j.wait(None)
if event == journal.APPEND:
for entry in j:
m = entry['MESSAGE']
if not isinstance(m, str):
entry['MESSAGE'] = m.decode(enc8b)
step = workflow.firstStep
while step is not None:
step = step.run(entry)