[html-formfu] utf-8 nightmare

Ferruccio Zamuner nonsolosoft at diff.org
Sun Dec 14 14:00:17 GMT 2008


Ferruccio Zamuner wrote:
> Hi,
>
> "HTML::FormFu::Filter::Encode: Unable to decode given string to utf8 =

> at /usr/pkg/lib/perl5/site_perl/5.10.0/HTML/FormFu/Filter/Encode.pm =

> line 17."
>
> string is =93Perl=94 and L=92A
>
> or looking at it from emacs: "\x{201C}Perl\x{201D} and L\x{2019}A"
>
> I've written my web app to be sure that everything is utf-8 and I'm =

> using html::form to enforce charset input conversion too.
I've written a simple patch to avoid double utf-8 encoding from =

HMTL::FormFu::Filter::Encode.
It's attached to this mail.


Best regards,                \fer
-------------- next part --------------
Index: HTML-FormFu/lib/HTML/FormFu/Filter/Encode.pm
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- HTML-FormFu/lib/HTML/FormFu/Filter/Encode.pm	(revisione 1267)
+++ HTML-FormFu/lib/HTML/FormFu/Filter/Encode.pm	(copia locale)
@@ -12,7 +12,7 @@
 =

     return if !defined $value;
 =

-    my $utf8 =3D $self->decode_to_utf8($value);
+    my $utf8 =3D ( utf8::is_utf8($value) ? $value : $self->decode_to_utf8(=
$value));
 =

     die "HTML::FormFu::Filter::Encode: Unable to decode given string to ut=
f8"
         if !defined $utf8;


More information about the HTML-FormFu mailing list