UTF-8 + HTML::Template + CGI::Fast

Philip Potter philip.g.potter at gmail.com
Fri Dec 4 12:32:09 GMT 2009


2009/12/4 Nicholas Clark <nick at ccl4.org>:
> On Fri, Dec 04, 2009 at 11:49:09AM +0000, Philip Potter wrote:
>
>> 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:
>> HTTP header.
>>
>> 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?
>
> I've not used it, but see http://www.joshisanerd.com/set/
> and Encode::HEBCI.
>
> It's a very crafty idea of using HTML entities and hidden form fields to start
> to deduce which particular crack the browser is smoking.

Great idea! The demo app recognised all encodings I threw at it except
macFarsi...
I also found this document:
http://niwo.mnsys.org/saved/~flavell/charset/form-i18n.html
which, though maybe a little dated, covers the issues involved well.

Phil


More information about the london.pm mailing list