httpd-apreq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Markus Wichitill <ma...@gmx.de>
Subject Re: Apache::Request, APR::Table and UTF8
Date Thu, 07 Oct 2004 22:29:12 GMT
Boris Zentner wrote:
>>> 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.

As I said, I know this simple all-or-nothing approach is not the solution 
you want, but it's certainly "possible" and a solution that would be enough 
for most applications. I don't know what kind of mixed input your 
application receives in a single request, but in the common case of a 
browser-submitted form, it's either all UTF-8 or not, depending on the 
encoding of the HTML page (or maybe the accept-charset attribute, if any 
browsers support that).

My stance here is that your application with mixed input is rather specific 
if not unusual, and therefore needs to do its own handling of the issue, 
even if that means you have to do more wrapping/subclassing and have to 
educate your co-developers about how to use the resulting interfaces. Which 
you already did.

A light-weight library like apreq should not try to handle every possible 
format under the sun, that's why I've already cautioned against linking in 
full XML support.

> Also I can think of the DECODE_UTF8 flag from your example as a 
> utf8-flag-on-for-all parameters in the table.

Technically utf8::decode doesn't set the flag for 7-bit strings.

> 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.

We seem to mainly differ about whose responsibility it is to handle the 
UTF-8 issue, the developer's who has all the relevant info, or that of a 
thin XS layer over Apache internals, which doesn't know anything about the 
context of the incoming data.

BTW, I think you make things look a bit too simple in your first post by 
hiding much of the real complexity behind $something and $something_else. 
I'm still not sure if you expect Apache::Request to do heuristic scanning of 
the input to automatically determine the encoding (which would be unreliable 
at best)?

> Again, no conversion just back what I put in that is the minimum 
> requirement for any data-store. 

Stop thinking of those tables as data stores, they're APIs to a webserver 
that doesn't really support Unicode. Of course I might be biased, since I've 
always treated Apache::Request as a read-only object anyway.

Mime
View raw message