httpd-apreq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Boris Zentner <...@2bz.de>
Subject Re: Apache::Request, APR::Table and UTF8
Date Thu, 07 Oct 2004 20:31:17 GMT

Hi again,

Am 07.10.2004 um 20:50 schrieb Geoffrey Young:

>
>> A simple form of UTF-8 support in Apache::Request that I wouldn't mind
>> would be a flag "DECODE_UTF8 => 1", that when passed to new() would
>> cause Apache::Request to call utf8::decode on the returned string 
>> every
>> time param(), body() etc. is called, but would leave the original

This is not possible. The reason is that if you call decode for every 
parameter, *ALL* parameters must be in utf8. That is not true.
Also I can think of the DECODE_UTF8 flag from your example as a 
utf8-flag-on-for-all parameters in the table. This is wrong for the 
same reason as always off is wrong.

>> data/tables alone. That might be convenient when writing small 
>> handlers
>> that don't warrant a library with wrapper functions etc.
>
> this sounds like a libapreq-1.XX wrapper that my coauthor paul wrote - 
> IIRC
> he said he was using pretty much the exact same thing at critical path 
> at
> the time.
>
>   # the wrappers themselves
>   http://www.modperlcookbook.org/code/ch10/Cookbook/TransformRequest.pm
>   http://www.modperlcookbook.org/code/ch10/Cookbook/UTF8Request.pm
>
>   # sample usage
>   http://www.modperlcookbook.org/code/ch10/Cookbook/Japanese.pm
>
> I'm not sure how portable this is to libapreq2, but it can't be that 
> far
> off.  it also was quite a few years ago at this point, so you might 
> want to
> do something more clever now :)

My current solution is subclass Apache::Request copy all data to a CGI 
like object with utf8 conversion, where needed. Then all other modules 
act only on the CGI object with the correct utf8 flags and values. This 
is far better than any hacks for all on or all off aproach.

I understand, that APR::Table can not change it's current behavior. But 
Apache::Request can and should. I'm really frightened that so much 
emails and examples do not convert you all on how important correct 
data for perl is.

Again, no conversion just back what I put in that is the minimum 
requirement for any data-store. There is no option, perl do it 
automatic.

--
Boris


Mime
View raw message