From: Graham Knop Date: Sun, 21 Oct 2018 09:11:27 +0000 (+0200) Subject: use PerlIO::utf8_strict for decoding uploads X-Git-Tag: v5.90_121~4 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=commitdiff_plain;h=da94772a5abc26038fbb2611ff530d85b81870d6;hp=2d48c2fc524aa2c1c077ba4be61970ed698af12d use PerlIO::utf8_strict for decoding uploads PerlIO::utf8_strict is faster than the encoding layer. --- diff --git a/Makefile.PL b/Makefile.PL index 3397a3d..8289765 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -78,6 +78,7 @@ my %META = ( "Plack::Middleware::FixMissingBodyInRedirect" => '0.09', "Plack::Middleware::MethodOverride" => '0.12', "Plack::Middleware::RemoveRedundantBody" => '0.03', + 'PerlIO::utf8_strict' => 0, }, }, develop => { diff --git a/lib/Catalyst/Request/Upload.pm b/lib/Catalyst/Request/Upload.pm index 486653c..e4c35ed 100644 --- a/lib/Catalyst/Request/Upload.pm +++ b/lib/Catalyst/Request/Upload.pm @@ -7,6 +7,7 @@ use Catalyst::Exception; use File::Copy (); use IO::File (); use File::Spec::Unix; +use PerlIO::utf8_strict; use namespace::clean -except => 'meta'; has filename => (is => 'rw'); @@ -157,7 +158,7 @@ sub decoded_fh { my ($self, $layer) = @_; my $fh = $self->fh; - $layer = ":encoding(UTF-8)" if !$layer && $self->is_utf8_encoded; + $layer = ':utf8_strict' if !$layer && $self->is_utf8_encoded; $layer = ':raw' unless $layer; binmode($fh, $layer);