quetz-mod_python-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Graham Dumpleton <graham.dumple...@gmail.com>
Subject Re: Mod_python and unicode
Date Sat, 06 Mar 2010 11:35:50 GMT
On 5 March 2010 19:59, Anders Blomdell <anders.blomdell@control.lth.se> wrote:
> Would it make sense to switch mod_python to always use unicode,

No.

> as it is now,
> publisher supports unicode content, but req.write and FieldList does use
> bytestrings.

How is mod_python supposed to automagically know what is the correct
charset to use on request content and response content. It can't, only
your web application will know for certain. Even now with publisher,
you should not be relying on the fact that unicode response content is
converted to bytes automatically. If you do, then your code will not
be portable because if run on a system where the default encoding is
something different, it will break. This is because when you return
unicode, it is applying the default encoding.

Graham

Mime
View raw message