Fix errors when saving unencoded 8bit headers.

Signed-off-by: Thomas Hochstein <thh@thh.name>
This commit is contained in:
Thomas Hochstein 2025-06-29 12:23:12 +02:00
parent d989c98d5b
commit 637d043364

View file

@ -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);