Convert Usevote to UTF-8.
Signed-off-by: Thomas Hochstein <thh@thh.name>
This commit is contained in:
parent
162c5aefda
commit
a60ea76fe8
8 changed files with 31 additions and 7 deletions
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue