Hello,
there are two problems with uri filter:
o) it can't encode properly Unicode characters and
o) it doesn't do the same thing as Gisle Aas' URI::Escape - it should escape all characters which are not part of the "uric" character class (specified in RFC 2396) as well as the reserved characters. The default character class that is not escaped by URI::Escape is [A-Za-z0-9\-_.!~*'()]


Here is a patch that fixes these problems:

diff -Naur Template-Toolkit-2.14/lib/Template/Filters.pm Template-Toolkit-2.14-patched/lib/Template/Filters.pm
--- Template-Toolkit-2.14/lib/Template/Filters.pm
+++ Template-Toolkit-2.14-patched/lib/Template/Filters.pm
@@ -278,7 +278,8 @@
map { ( chr($_), sprintf("%%%02X", $_) ) } (0..255),
};


-    $text =~ s/([^;\/?:@&=+\$,A-Za-z0-9\-_.!~*'()])/$URI_ESCAPES->{$1}/g;
+    use bytes;
+    $text =~ s/([^A-Za-z0-9\-_.!~*'()])/$URI_ESCAPES->{$1}/g;
     $text;
 }


-- Sava Chankov ÐÐÐÐ ÐÐÐÐÐÐ research and development ÐÑÐÑÑÐÐÐÐ Ð ÑÐÐÐÐÐ http://www.blueboard.biz ÐÐÑÐÐÑÐ ÐÐÐ

_______________________________________________
templates mailing list
[email protected]
http://lists.template-toolkit.org/mailman/listinfo/templates

Reply via email to