Results tagged “percent-encoding”

rocks near Greens Fork, Indiana
In my [previous post](http://mark.stosberg.com/blog/2010/12/percent-encoding-uris-in-perl.html) I summarized the current state of Percent-encoding in Perl. One of my conclusions was that the perfect percent-encoding solution would automatically handle UTF-8 encoding, using logic like this: utf8::encode $string if utf8::is_utf8 $string; Respected Plack author miyagawa quickly responded [in a response post](http://bulknews.typepad.com/blog/2010/12/re-percent-encoding-uris-in-perl-mark-stosberg.html) to say that the above code approach is a bug, although the code pattern is already wide use as it is present in Catalyst, CGI.pm (and by extension CGI::Application and other frameworks) as well as Mojo. In one sense, he's right. The pattern goes against the advice found in the official [perlunifaq](http://perldoc.perl.org/perlunifaq.html#What-is-%22the-UTF8-flag%22%3f) documentation which states that > It's better to pretend that the internal format is some unknown encoding, and > that you always have to encode and decode explicitly. In other words: don't use the "is_utf8()" function. Before drawing a conclusion whether this code pattern is the best design in *in practice,* let's look some related facts about the matter.
1
Close