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.
Results tagged “percent-encoding”