Setting Content-Type in a custom response (mp2)

"Steve Hay" <[email protected]>
Newsgroups gmane.comp.apache.mod-perl
Message-ID <[email protected]>
I have a mod_perl-2 handler that uses custom_response() to display error
messages if something goes wrong:

$r->custom_response(Apache2::Const::SERVER_ERROR, $error);
return Apache2::Const::SERVER_ERROR;

That almost works fine, but the trouble is that the Content-Type header
is always set to "text/html; charset=iso-8859-1", in which the charset,
at least, is potentially wrong: all the pages in my software produce
UTF-8 and are normally output with Content-Type "application/xhtml+xml;
charset=utf-8".

How do I set the Content-Type when issuing a custom_reponse()? The usual
thing of calling

$r->content_type("application/xhtml+xml; charset=utf-8");

doesn't seem to work in this case.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.