From: Erik <eri...@bo...> - 2005-11-24 08:32:58
|
tor 2005-11-24 klockan 09:05 +0200 skrev Damyan Ivanov:=20 > Shimon Rura wrote: > > Erik, > >=20 > > Unfortunately, I don't think there is a perfect solution to this. The >=20 > Whatever encoding a browses uses to send data, it is mandatory to supply > correct Content-Type header, right? Can't this be used when determining r= equest > encoding? Hmmm I did some checks on that and the only Content-Type header are from the server to the browser. The other way around I can only find Accept-Charset. That aren't the same. So afaik there are only one way to do this the nice way. And that is to remember what encoding I did send the page in. And that should be saved in the session. The bad thing is that _every_ request needs a session :/ But if we add a new option in the Configfile eq output_charset (that mean use this if you can regardless of priority from the browser. But if the browser don't know this charset the use priority.) The the encoding for browser that don't use cookies (can't use sessions) we could guess the char-set to output_charset. With this it should be possible with a pretty god chans to find the right charset-encoding from the browser. =20 Implementation: * New option in Config.xml that means use this charset if possible output_charset =3D "UTF-8"=20 * When a request arrives we first look in the session for _encoding to see what encoding the request most likely be in and the change encoding to default_input_charset. This only needs to be done on request with parameters (when QUERY_STRING or REQUEST_METHOD=3D'post'). If no session or _encoding exists then use output_charset.=20 If output_charset, default_input_charset and default_output_charset are utf-8 then there are pretty small chances that a conversion ever is needed.=20 If no output_charset exists in the config file the use the same behavior we have to day, with no input_conversion. Ideas? comments? If not I'll try to do some/all of this this weekend. |