Hi all
There seems to be a bug in the mod_perl2/apache2 handling of character
sets for $r->custom_response(). I'm not sure which is at fault.
My pages are all in UTF8, but I can't find a way to set this character
set for custom generated error pages.
I've tried:
- $r->content_type('text/html; charset = utf8');
- $r->err_headers_out('Content-type' =>'text/html; charset = utf8');
- <meta http-equiv = "Content-Type" content = "text/html; charset=utf-8" />
- AddDefaultCharset UTF8
to no avail - apache always overrides this with:
Content-Type: text/html; charset=iso-8859-1
According to the apache docs for AddDefaultCharset:
Note: This will not have any effect on the Content-Type and
character set for default Apache-generated status pages (such as
'404 Not Found' or '301 Moved Permanently') because those have
an actual character set (that in which the hard-coded page
content is written) and don't need to have a default applied.
That implies that the character set is taken from the file itself, but
that shouldn't apply to errors generated with
$r->custom_response($error_msg)
For now, I plan to just entity escape anything that isn't in the ASCII
range, but is there a workaround? Should this be fixed?
thanks
Clint