From 637d0433641a2d73b10e264472359a0090c68d35 Mon Sep 17 00:00:00 2001 From: Thomas Hochstein Date: Sun, 29 Jun 2025 12:23:12 +0200 Subject: [PATCH] Fix errors when saving unencoded 8bit headers. Signed-off-by: Thomas Hochstein --- bin/feedlog.pl | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/bin/feedlog.pl b/bin/feedlog.pl index 9b1fd96..0ab963e 100755 --- a/bin/feedlog.pl +++ b/bin/feedlog.pl @@ -26,6 +26,7 @@ use Sys::Syslog qw(:standard :macros); use Date::Format; use DBI; +use Encode qw(encode); use Getopt::Long qw(GetOptions); Getopt::Long::config ('bundling'); @@ -106,6 +107,9 @@ while (<>) { $Headers .= $_."\n" ; } + # convert headers to UTF-8, if necessary + $Headers = encode('utf-8', $Headers) if ($Headers =~ /[\x80-\x{ffff}]/); + # parse timestamp to day (YYYY-MM-DD) and to MySQL timestamp my $Day = time2str("%Y-%m-%d", $Timestamp); my $Date = time2str("%Y-%m-%d %H:%M:%S", $Timestamp);