perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From André Warnier ...@ice-sa.com>
Subject Re: utf8 urls
Date Wed, 19 Mar 2008 12:42:14 GMT
 From a previous message by Adam Prime in this same list :
[...]
SetHandler modperl doesn't bind 'print' to '$r->print'.  Try SetHandler 
perl-script, or change your code to pass in the request object and use 
$r->print instead of print.
[...]

or, more verbously and explicitly :
if in your Apache configuration for this "location", you used

SetHandler modperl

then, you should not assume that print() sends its output to the 
browser.  But if you did (like you did)

$r = shift; # get the Apache::RequestRec object

then  $r->print() does go back as a response to the browser.
You should probably at least set a content-type header though,
like

$r->content_type('text/plain');
$r->print $apr->param('id');

and, in your case, it might also be a good idea to send back a header 
indicating which is the character set used (presumably UTF-8), since the 
default HTTP character set is iso-8859-1, and the string you send back 
doesn't look as being printable in that charset.

But I don't know exactly how to do that best in mod_perl.
Would the following work ?
$r->content_type('text/plain; charset="UTF-8"');

Also, the previous message talking about how to handle your (apparently) 
UTF-8 request should be taken into account.


André


Eli Shemer wrote:
> Hey there
> 
>  
> 
> For some reason the following test doesn’t print anything out to the screen
> 
> Do I need to change something in the apache configuration, or mod_perl’s ?
> 
>  
> 
> /articles_read.pl?id=חוזרת
> 
>  
> 
> ## get http parameters
> 
> $r = shift;
> 
> $apr = Apache2::Request->new($r);
> 
> print  $apr->param('id');
> 
>  
> 
>  
> 
> thanks in advance.
> 
>  
> 
> 
> Internal Virus Database is out-of-date.
> Checked by AVG Free Edition. 
> Version: 7.5.503 / Virus Database: 269.16.4/1146 - Release Date: 22/11/2007
> 18:55
>  
> 

Mime
View raw message