UTF-8 + HTML::Template + CGI::Fast
philip.g.potter at gmail.com
Fri Dec 4 11:49:09 GMT 2009
2009/12/4 Andrew McGregor <andy at txm.net>:
>> If a user enters UTF-8 chars then the string displayed is corrupt, or
>> looks like it has been double encoded.
> Adding this:
> 1293 $rtbx_senderDetails = decode("utf8", $rtbx_senderDetails);
> Just before passing the param to HTML::Template seems to work.
> So I'm switching the UTF flag on which means it is handled correctly
> by HTML::Template?
> Also, is there a more global way to resolve this as there are a few fields?
I don't know if this problem is in general solvable, because user
agents are not required to declare what encoding they are using to
submit form contents. Even when the form uses the
accept-charset="utf-8" attribute to restrict the user agent to only
one charset, firefox doesn't append charset=utf-8 to the Content-type:
I don't see how you're supposed to guess what encoding the user agent
used if it won't tell you. Does anyone else have any ideas?
More information about the london.pm