[prev] [thread] [next] [Date index for 2005/01/28]
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 esc=
ape all=20
characters which are not part of the "uric" character class (specified in=
RFC=20
2396) as well as the reserved characters. The default character class tha=
t is=20
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=20
Template-Toolkit-2.14-patched/lib/Template/Filters.pm
--- Template-Toolkit-2.14/lib/Template/Filters.pm=09
+++ Template-Toolkit-2.14-patched/lib/Template/Filters.pm=09
@@ -278,7 +278,8 @@
map { ( chr($_), sprintf("%%%02X", $_) ) } (0..255),
};
- $text =3D~ s/([^;\/?:@&=3D+\$,A-Za-z0-9\-_.!~*'()])/$URI_ESCAPES->{$=
1}/g;
+ use bytes;
+ $text =3D~ s/([^A-Za-z0-9\-_.!~*'()])/$URI_ESCAPES->{$1}/g;
$text;
}
--=20
Sava Chankov =D0=A1=D0=B0=D0=B2=D0=B0=
=D0=A7=D0=B0=D0=BD=D0=BA=D0=BE=D0=B2
research and development =D0=BF=D1=80=D0=BE=D1=83=D1=87=D0=
=B2=D0=B0=D0=BD=D0=B5 =D0=B8 =D1=80=D0=B0=D0=B7=D0=B2=D0=BE=D0=B9
http://www.blueboard.biz =D0=B1=D0=BB=D1=83=D0=B1=
=D0=BE=D1=80=D0=B4 =D0=BE=D0=BE=D0=B4
_______________________________________________
templates mailing list
templates@xxxxxxxxxxxxxxxx.xxx
http://lists.template-toolkit.org/mailman/listinfo/templates
|
[Templates] uri filter bugs
|
Generated at 08:55 on 15 Mar 2005 by mariachi v0.52