[Templates] [patch] for uri_filter and url_filter - Template::Filters

Jonathan Rockway jon@jrock.us
Wed, 12 Sep 2007 03:44:57 -0500


This is an OpenPGP/MIME signed message (RFC 2440 and 3156)
--------------enig6BED78B605114C37FE340BD3
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

Kazuma Shiraiwa wrote:
> Hi,
>
> Template::Filters 2.86 "uri_filter" and "url_filter" use utf8::encode.
>
> At least utf8::encode has problem in Japanese character without utf8 fl=
ag.
> view "sample.pl".
> and view "Template-Filter.patch".
>
> Please use this patch when it is good.
>  =20
Hi,

Your code is broken if you have characters outside of latin-1 in memory
without the utf8 flag on.  Do something like:

   use Encode;
   my $euc_jp_octets =3D read_file('/path/to/the/file'); # or whatever
   my $data =3D Encode::decode('euc-jp', '$euc_jp_octets);
   ...
   $data =3D~ s/.../.../; # whatever... anything that modifies $data
   ...
   print Encode::encode('euc-jp', $data);

The decode/encode is also needed for utf8... anything other than ASCII,
basically.

Regards,
Jonathan Rockway


--------------enig6BED78B605114C37FE340BD3
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iQCVAwUBRuenCtAZeFPdJeQvAQIWaAP+Lw3vlSINZNvA20mBGr3g9b7rGipSjH0R
YQpL9TMbJi7YOThlvoDMsxLeSN/Gnn8xxXu0GDx6ZBR1gYLxFa4n/ze2lR53zLuY
pg+wYyD7zC7wQ+ltJQvDamNouGEbAeTA1EOGFs5R7YQgpwEdmxsPpuOZY3Iky5GZ
XVbec9yhq+w=
=GVVJ
-----END PGP SIGNATURE-----

--------------enig6BED78B605114C37FE340BD3--