[interchange] Fix more 'utf8'-based Encode::Alias issues
David Christensen <[email protected]> Wed, 05 Oct 2016 19:38:39 +0000
| Newsgroups | gmane.comp.web.interchange.cvs |
|---|---|
| Message-ID | <[email protected]> |
commit b971e1ed86b4097dd0a414c90fbcd271e9174501 Author: David Christensen <[email protected]> Date: Wed Oct 5 14:36:42 2016 -0500 Fix more 'utf8'-based Encode::Alias issues These are places where the lack of a hyphen was significant and contributing to errors when called from within a Safe container. code/UserTag/email.tag | 12 ++++++------ lib/Vend/File.pm | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) --- diff --git a/code/UserTag/email.tag b/code/UserTag/email.tag index eaaf5fe..d12aaaf 100644 --- a/code/UserTag/email.tag +++ b/code/UserTag/email.tag @@ -27,7 +27,7 @@ sub utf8_to_other { return $string unless $Have_encode; # nop if no Encode unless(Encode::is_utf8($string)){ - $string = Encode::decode('utf-8', $string); + $string = Encode::decode('utf8', $string); } return Encode::encode($encoding, $string); } @@ -73,7 +73,7 @@ sub { # force utf8 email through MIME as attachment unless (($opt->{attach} || $opt->{html}) && $utf8){ $opt->{body_mime} = $opt->{mimetype}; - $body = utf8_to_other($body, 'utf-8'); + $body = utf8_to_other($body, 'utf8'); } my $sent_with_attach = 0; @@ -118,7 +118,7 @@ sub { } else { $msg_args{Type} ||= 'text/html' . ($utf8 ? '; charset=UTF-8' : ''); - $msg_args{Data} ||= ($utf8 ? utf8_to_other($opt->{html}, 'utf-8') : $opt->{html}); + $msg_args{Data} ||= ($utf8 ? utf8_to_other($opt->{html}, 'utf8') : $opt->{html}); } $att1_format = 'flowed'; @@ -136,7 +136,7 @@ sub { my $content = $2 or next; $name =~ s/[-_]+/-/g; $name =~ s/\b(\w)/\U$1/g; - $msg->add($name, ($utf8 ? utf8_to_other($content, 'UTF-8') + $msg->add($name, ($utf8 ? utf8_to_other($content, 'utf8') : $content)) if $name && $content; } @@ -147,7 +147,7 @@ sub { $msg->attach( Type => $opt->{body_mime}, Encoding => $opt->{body_encoding}, - Data => ($utf8 ? utf8_to_other($body, 'utf-8') : $body), + Data => ($utf8 ? utf8_to_other($body, 'utf8') : $body), Disposition => $opt->{body_disposition} || 'inline', Format => $opt->{body_format} || $att1_format, ); @@ -181,7 +181,7 @@ sub { if($opt->{html} && $body =~ /\S/) { unshift @$att, {type => 'text/html' .($utf8 ? '; charset=UTF-8': ''), - data => ($utf8 ? utf8_to_other($opt->{html}, 'UTF-8') : $opt->{html}), + data => ($utf8 ? utf8_to_other($opt->{html}, 'utf8') : $opt->{html}), disposition => 'inline', }; } diff --git a/lib/Vend/File.pm b/lib/Vend/File.pm index 59a875c..565ad16 100644 --- a/lib/Vend/File.pm +++ b/lib/Vend/File.pm @@ -69,7 +69,7 @@ sub writefile { my($encoding, $fallback); if ($::Variable->{MV_UTF8} || $Global::Variable->{MV_UTF8}) { - $encoding = $opt->{encoding} ||= 'utf-8'; + $encoding = $opt->{encoding} ||= 'utf8'; undef $encoding if $encoding eq 'raw'; $fallback = $opt->{fallback}; $fallback = $PERLQQ unless defined $fallback; @@ -201,7 +201,7 @@ sub readfile { $opt ||= {}; if ($::Variable->{MV_UTF8} || $Global::Variable->{MV_UTF8}) { - $encoding = $opt->{encoding} ||= 'utf-8'; + $encoding = $opt->{encoding} ||= 'utf8'; $fallback = $opt->{fallback}; $fallback = $PERLQQ unless defined $fallback; undef $encoding if $encoding eq 'raw';