Skip to content

Commit

Permalink
Fix more 'utf8'-based Encode::Alias issues
Browse files Browse the repository at this point in the history
These are places where the lack of a hyphen was significant and
contributing to errors when called from within a Safe container.
  • Loading branch information
David Christensen committed Oct 5, 2016
1 parent d145294 commit b971e1e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
12 changes: 6 additions & 6 deletions code/UserTag/email.tag
Expand Up @@ -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);
}
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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';
Expand All @@ -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;
}
Expand All @@ -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,
);
Expand Down Expand Up @@ -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',
};
}
Expand Down
4 changes: 2 additions & 2 deletions lib/Vend/File.pm
Expand Up @@ -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;
Expand Down Expand Up @@ -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';
Expand Down

0 comments on commit b971e1e

Please sign in to comment.