[html-formfu] utf-8 nightmare

Carl Franks fireartist at gmail.com
Sun Dec 14 16:12:25 GMT 2008


2008/12/14 Ferruccio Zamuner <nonsolosoft at diff.org>:
> Hi,
>
> yesterday I was teaching to my friend how to use my last catalyst web
> application when I've cut-and-paste a text from a yahoo group to insert in a
> form of my web app and it fails. Today I've repeated the operation with some
> chars and bang, it happens again:
>
> "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 "Perl" and L'A
>
> 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.
>
> How can I fix this?
> Need I to sanitize user input before html::formfu get in play?
>
>
> Thank you in advance for your reply.

My understanding is that if you're setting charset=utf-8 in either the
server response, or the (x)html head section, the browser should only
allow utf8 in form fields.

If you're doing that, this shouldn't be necessary, but you can also
set it in the form's attributes:

    ---
    attrs:
      accept-charset: UTF-8

I'm not sure under what circumstances Filter::Encode should be
necessary - I've never used it.
My best advice would be to read HTML::FormFu::Manual::Unicode

http://search.cpan.org/~cfranks/HTML-FormFu-0.03007/lib/HTML/FormFu/Manual/Unicode.pod

Carl



More information about the HTML-FormFu mailing list