unicode encoding usablilty problem

Jarek Zgoda jzgoda at gazeta.usun.pl
Fri Feb 18 15:26:28 EST 2005


Walter Dörwald napisał(a):

>> Is there a scheme for Python developer to use so that they are safe 
>> from  incorrect mixing?
> 
> 
> Put the following:
> 
> import sys
> sys.setdefaultencoding("undefined")
> 
> in a file named sitecustomize.py somewhere in your Python path and
> Python will complain whenever there's an implicit conversion between
> str and unicode.

This will help in your code, but there is big pile of modules in stdlib 
that are not unicode-friendly. From my daily practice come shlex 
(tokenizer works only with encoded strings) and logging (you cann't 
specify encoding for FileHandler).

-- 
Jarek Zgoda
http://jpa.berlios.de/ | http://www.zgodowie.org/



More information about the Python-list mailing list