[Jifty-commit] r3201 - jifty/trunk/lib/Jifty/View/Mason

jifty-commit at lists.jifty.org jifty-commit at lists.jifty.org
Sun May 6 20:00:54 EDT 2007

Author: ruz
Date: Sun May  6 20:00:54 2007
New Revision: 3201


* add docs to escape_uri
* fix it in the way need it to work, it's escape_uri_utf8. there is no
  way to escape binary and text scalars in one sub, we need the latter.

Modified: jifty/trunk/lib/Jifty/View/Mason/Handler.pm
--- jifty/trunk/lib/Jifty/View/Mason/Handler.pm	(original)
+++ jifty/trunk/lib/Jifty/View/Mason/Handler.pm	Sun May  6 20:00:54 2007
@@ -171,16 +171,20 @@
     $$ref =~ s/'/'/g;
 =head2 escape_uri SCALARREF
-Escapes URI component according to RFC2396
+Escapes in-place URI component according to RFC2396. Takes a reference to
+perl string.
+*Note* that octets would be treated as latin1 encoded sequence and converted
+to UTF-8 encoding and then escaped. So this sub always provide UTF-8 escaped
+string. See also L<Encode> for more info about converting.
 sub escape_uri {
     my $ref = shift;
-    use bytes;
+    $$ref = Encode::encode_utf8($$ref);
     $$ref =~ s/([^a-zA-Z0-9_.!~*'()-])/uc sprintf("%%%02X", ord($1))/eg;

More information about the Jifty-commit mailing list