[cgiapp] UTF-8 output

Michael Peters mpeters at plusthree.com
Mon Nov 2 09:27:00 EST 2009


On 11/02/2009 12:43 AM, Michael Lackhoff wrote:

> Without the header_add I get
> a HTTP header with an ISO-8859-1 charset definition so the browser
> thinks it is latin1 and even a
> <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
> in the template won't help.

That's very strange. Does it happen the same across all browsers? The 
<meta> tag should be equivalent to the HTTP header.

> And is there no better way for the template output than to post_process
> the whole template? Is there no way to get the output of tt_process as
> UTF-8 so that there is no post_processing necessary?

I have a patched HTML::Template that reads in the templates as UTF8, my 
db connections are all UTF8 and I decode the CGI params as UTF8. As long 
as all your inputs are UTF8 decoded then you don't need to explicitly 
encode the output.

-- 
Michael Peters
Plus Three, LP


More information about the cgiapp mailing list