You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Chris Jacobson <ch...@online-rewards.com> on 2004/09/08 17:45:35 UTC
[mp2] Setting correct charset / content encoding for request
Hello! Let me get the system specs out of the way first...
Apache: 2.0.50
mod_perl: 1.99_16
Apreq2: 2.04-dev
Perl: 5.8.5
I am attempting to set the charset value in the response headers to
'utf8', but I can't seem to get it to drop the 'iso-8859-1' value for
some reason.
I began with the following code: (Assuming $ContentType = "text/html")
$r->content_type("$ContentType; charset=utf-8");
$r->print($Request);
And the response headers look like this:
Date: Wed, 08 Sep 2004 15:29:56 GMT
Server: Apache/2.0.50 (Unix) mod_perl/1.99_16 Perl/v5.8.5
Content-Type: text/html; charset=ISO-8859-1
Then I changed the code to use the content_encoding function:
$r->content_type($ContentType); #("$ContentType;
charset=utf-8");
$r->content_encoding("utf8");
$r->print($Request);
And now the response headers look like this:
Date: Wed, 08 Sep 2004 15:33:21 GMT
Server: Apache/2.0.50 (Unix) mod_perl/1.99_16 Perl/v5.8.5
Content-Type: text/html; charset=ISO-8859-1
Content-Encoding: utf8
For some reason, I cannot get the "Content-Type:" string to just be
"text/html" or "text/html; charset=utf8". I have a feeling that
"Content-Encoding" has nothing to do with what I am trying to achieve
here.... Am I missing something completely obvious here? Any help would
be appreciated.
Thanks,
Chris Jacobson
--
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html
Re: [mp2] Setting correct charset / content encoding for request
Posted by Stas Bekman <st...@stason.org>.
Chris Jacobson wrote:
> Hello! Let me get the system specs out of the way first...
>
> Apache: 2.0.50
> mod_perl: 1.99_16
> Apreq2: 2.04-dev
> Perl: 5.8.5
>
> I am attempting to set the charset value in the response headers to
> 'utf8', but I can't seem to get it to drop the 'iso-8859-1' value for
> some reason.
>
> I began with the following code: (Assuming $ContentType = "text/html")
>
> $r->content_type("$ContentType; charset=utf-8");
> $r->print($Request);
>
> And the response headers look like this:
>
> Date: Wed, 08 Sep 2004 15:29:56 GMT
> Server: Apache/2.0.50 (Unix) mod_perl/1.99_16 Perl/v5.8.5
> Content-Type: text/html; charset=ISO-8859-1
>
>
> Then I changed the code to use the content_encoding function:
>
> $r->content_type($ContentType); #("$ContentType;
> charset=utf-8");
> $r->content_encoding("utf8");
> $r->print($Request);
>
> And now the response headers look like this:
>
> Date: Wed, 08 Sep 2004 15:33:21 GMT
> Server: Apache/2.0.50 (Unix) mod_perl/1.99_16 Perl/v5.8.5
> Content-Type: text/html; charset=ISO-8859-1
> Content-Encoding: utf8
>
> For some reason, I cannot get the "Content-Type:" string to just be
> "text/html" or "text/html; charset=utf8". I have a feeling that
> "Content-Encoding" has nothing to do with what I am trying to achieve
> here.... Am I missing something completely obvious here? Any help would
> be appreciated.
What's $r? Is it a genuine $r or an Apache::Request subclass? Could you
please submit an A-T skeleton so we can reproduce the problem you are
talking about?
http://perl.apache.org/docs/2.0/user/help/help.html#Reporting_Problems
http://perl.apache.org/docs/2.0/user/help/help.html#Problem_Description
http://perl.apache.org/~geoff/bug-reporting-skeleton-mp2.tar.gz
Thanks.
--
__________________________________________________________________
Stas Bekman JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org http://ticketmaster.com
--
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html