On 3/21/08, Jonathan Rockway <[EMAIL PROTECTED]> wrote:
> The need to check if something is already decoded hints at the existence
> of other bugs.

Yes. As we talked the other day on irc, the fact there's no consensus
which plugin to decode $c->req->param and anyone can write a plugin to
do that, to make a messy situation like this, is considered a bug.

> Encoding/decoding really boils down to knowing *for
> sure* what data you already have.  If we don't know what data we have,
> we can't safely decode it.

Yes, and perl 5.x doesn't have a programatic way to know this. Sad.

> Is anyone having a problem with decoding things that are already
> decoded?  Or is this only a theoretical problem?

Encode.pm dies if you try to decode an already decoded string.

> perl -MEncode -we '$s=chr(0x1234); Encode::decode("utf-8",$s)'
Cannot decode string with wide characters at
/System/Library/Perl/5.8.6/darwin-thread-multi-2level/Encode.pm line
162.

Interestingly, utf8::decode() and Encode::encode_utf8() are safe to
this. They don't die and just ignore your stupidness, which may be
good.

-
Tatsuhiko Miyagawa

_______________________________________________
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/

Reply via email to