Michael Lackhoff wrote:

> use utf8;
> sub streamtest {
>     my $self = shift;
>     $self->header_type('none'); # for streaming
>     # Write the content type to the client...
>     my $r = $self->param('r');
>     $r->content_type( 'text/html; charset=utf-8' );
> 
>     print q{<html>
>     <body>
>     <h1>Streaming-Test äüß </h1>
>     </body>
>     </html>
>     };
>     return '';
> }

Is this a mod_perl problem? You didn't mention if it occurred in plain CGI or 
not.

> The script with the extended characters is written in UTF8 but the
> resulting page has the extended characters in latin1.
> Background: This is a runmode of a CGI::Application but it shouldn't
> make a difference because I don't use the CGI::Application magic
> (sending headers and output of the result) in this runmode.

Why aren't you using C::A's help in this case? I've done UTF-8 in C::A before.
The key is to tell CGI.pm that you're using UTF-8 (but get v3.30 from RT since
2.29 has UTF-8 issues).

> Any ideas what may be going wrong here and why the output is converted
> back to latin1?

CGI.pm uses STDOUT to send the contents. So we need

  binmode(STDOUT, ':utf8');

I'm not sure if that works when using $r->print() though.

-- 
Michael Peters
Developer
Plus Three, LP

Reply via email to