[Catalyst] Patch for Catalyst::Plugin::Unicode::Encoding
Bill Moseley
moseley at hank.org
Tue Mar 18 11:01:41 GMT 2008
On Tue, Mar 18, 2008 at 03:38:06AM -0500, Jonathan Rockway wrote:
> * On Tue, Mar 18 2008, Bill Moseley wrote:
> > The plugin decodes all parameters using:
> >
> > $_ = $c->encoding->decode( $_, $CHECK ) for ( ref($value) ? @{$value} : $value );
> >
> >
> > I'd think it would be wise to check to see if the string is already
> > decoded:
> >
> > for ( ref($value) ? @{$value} : $value ) {
> > next if Encode::is_utf8($_);
> > $_ = $c->encoding->decode( $_, $CHECK );
> > }
>
> Never check is_utf8. Encode will do the right thing regardless of
> the internal representation of the string.
>
This is decoding, not encoding.
Without testing is_utf8 and if the parameters are already decoded I
rightly get:
[error] Caught exception in engine "Cannot decode string with wide
characters at
/usr/local/share/perl/5.8.8/Catalyst/Plugin/Unicode/Encoding.pm
line 74."
> http://blog.jrock.us/articles/Fuck%20the%20internal%20representation.pod
Yes, checking is_ut8 before encoding doesn't make sense.
--
Bill Moseley
moseley at hank.org
More information about the Catalyst
mailing list