[mod_python] Unicode support?

Jon-Pierre Gentil jgentil at sebistar.net
Thu Jun 24 09:44:56 EDT 2004


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Mateusz Korniak wrote:

>> =============
>> Mod_python error: "PythonHandler mod_python.publisher"
>>
>> Traceback (most recent call last):
>>
>>  File "/usr/lib/python2.3/site-packages/mod_python/apache.py", line
>> 299, in HandlerDispatch
>>    result = object(req)
>>
>>  File "/usr/lib/python2.3/site-packages/mod_python/publisher.py", line
>> 143, in handler
>>    result = str(result)
>>
>> UnicodeEncodeError: 'ascii' codec can't encode characters in position
>> 2144-2145: ordinal not in range(128)
>> ==============
>>
>> Why does it re-encode it?
>>
>>
> I assume result is unicode string, so str() tries to convert it to local
> representation, which may be 'ascii' for mod_python.
>
> Try:
> result = result.encode("utf-8")

My point is that the code is in publisher.py, inside mod_python.  I'm
not going to change the code of mod_python, at least without making a
patch for it... and consulting the developers.  I understand the process
of converting unicode strings, I just wish that mod_python wouldn't do
it at all.




- --
::  Jon-Pierre Gentil
::  PGP Key ID 0xA21BC30E
::  Jabber: jgentil at jabber.org
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iEYEARECAAYFAkDa2tcACgkQOrVFmaIbww4JEgCguZw5KQ8i9oKa+b5OUyOPoMhX
lUYAn1glRzTnX9MnIUKXSPdpeMBpl/5l
=gssa
-----END PGP SIGNATURE-----


More information about the Mod_python mailing list