Convert Usevote to UTF-8.

Signed-off-by: Thomas Hochstein <thh@thh.name>
This commit is contained in:
Thomas Hochstein 2026-02-08 15:06:05 +01:00
parent 162c5aefda
commit a60ea76fe8
8 changed files with 31 additions and 7 deletions

View file

@ -3,9 +3,12 @@
package UVreadmail;
use utf8;
use open qw(:std :encoding(UTF-8));
use strict;
use UVconfig;
use UVmessage;
use Encode qw(decode :fallbacks);
use MIME::QuotedPrint;
use MIME::Base64;
use MIME::Parser;
@ -200,6 +203,7 @@ sub process {
# extract address and name
my $from = $head->get('From') || '';
utf8::decode($from); # fix double encoding
if ($from =~ /\s*([^<]\S+\@\S+[^>]) \((.+)\)/) {
($voter_addr, $voter_name) = ($1, $2);
@ -240,6 +244,13 @@ sub process {
$body = $entity->stringify_body;
}
# body: charset conversion to Perl internal representation
my $ct = $head->get('Content-Type') || '';
if ($ct =~ /^text\/plain;.*charset=\"?([-a-zA-Z0-9]+)\"?/i) {
my $charset = $1;
$body = decode($charset, $body, FB_CROAK);
}
my $h_date = $head->get('Date') || '';
chomp $h_date;