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

2008-03-19 Thread Bill Moseley
On Wed, Mar 19, 2008 at 07:32:27AM -0700, Bill Moseley wrote: > > unless ( Encode::is_utf8( $c->response->body ) ) { > return $c->NEXT::finalize; > } BTW Jonathan, I realize we are talking past each other on this a bit. This isn't the issue I originally posted about (decoding), b

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

2008-03-19 Thread Bill Moseley
On Wed, Mar 19, 2008 at 12:36:42AM -0500, Jonathan Rockway wrote: > * On Wed, Mar 19 2008, Jonathan Rockway wrote: > > > We should not need to check the flag. The incoming data should be > > encoded. Then we should decode it. Then we should not try to decode it > > again. > > A key thing I for

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

2008-03-18 Thread Tatsuhiko Miyagawa
Well, if is_utf8($c->req->param($foo)) returns true, it surely means the string was already decoded. But even if is_utf8 returns false it *might not mean* that the string was not decoded. And that's the most annoying part. my $foo = "bar"; # all ascii utf8::decode($foo); utf8::is_utf8($foo

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

2008-03-18 Thread Jonathan Rockway
* On Wed, Mar 19 2008, Jonathan Rockway wrote: > We should not need to check the flag. The incoming data should be > encoded. Then we should decode it. Then we should not try to decode it > again. A key thing I forgot to mention is that "is_utf8" doesn't mean "we tried to decode this already".

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

2008-03-18 Thread Jonathan Rockway
* On Tue, Mar 18 2008, Bill Moseley wrote: > 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 >

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

2008-03-18 Thread Bill Moseley
On Wed, Mar 19, 2008 at 12:04:37AM +, Jonas Alves wrote: > > > > No, you never should check the flag. See Miyagawa's post > http://use.perl.org/~miyagawa/journal/35700. You quoted the entire message -- what point where you commenting on. -- Bill Moseley [EMAIL PROTECTED] _

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

2008-03-18 Thread Jonas Alves
On Tue, Mar 18, 2008 at 11:01 AM, Bill Moseley <[EMAIL PROTECTED]> wrote: > 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

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

2008-03-18 Thread Bill Moseley
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 ch

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

2008-03-18 Thread Jonathan Rockway
* 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) ? @{$valu

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

2008-03-17 Thread Bill Moseley
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($_);