Skip to content

Commit

Permalink
fatalize "utf8" warnings in Mojo::Util::decode, instead of using a $f…
Browse files Browse the repository at this point in the history
…allback
  • Loading branch information
Grinnz committed Sep 3, 2015
1 parent 5fed71e commit 8eeb88c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/Mojo/Util.pm
Expand Up @@ -99,11 +99,11 @@ sub decamelize {

sub decode {
my ($encoding, $bytes) = @_;
my $fallback = sub {die};
use warnings FATAL => 'utf8';
return undef
unless (UUTF8 and $encoding eq 'UTF-8')
? eval { $bytes = Unicode::UTF8::decode_utf8($bytes, $fallback); 1 }
: eval { $bytes = _encoding($encoding)->decode("$bytes", 1); 1 };
? eval { $bytes = Unicode::UTF8::decode_utf8($bytes); 1 }
: eval { $bytes = _encoding($encoding)->decode("$bytes"); 1 };
return $bytes;
}

Expand Down

0 comments on commit 8eeb88c

Please sign in to comment.