[Catalyst] Patch for Catalyst::Plugin::Unicode::Encoding

Jonathan Rockway jon at jrock.us
Tue Mar 18 08:38:06 GMT 2008


* 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.

  http://blog.jrock.us/articles/Fuck%20the%20internal%20representation.pod

Regards,
Jonathan Rockway

-- 
print just => another => perl => hacker => if $,=$"



More information about the Catalyst mailing list