On Sat, Aug 29, 2009 at 10:00:06AM +0200, Klaus 'mrmoku' Kurzmann wrote: >Am Samstag 29 August 2009 04:31:28 schrieb David Reyes Samblas Martinez: >> the problem persist, so the conversion to ascii doesn't solve it, the >> problematic package description is pyelf-sudoku, it seems that is not >> on UTF-8 nor ascii, is that posible? >It is UTF-8 (at least if I can believe my vim which ususally I can :). >The only special char in there is the × in 9×9 and 3×3 ....
Python has one big suck in it wrt to character sets, it's using ascii by default and not utf-8. So the first part of the solution is to put the lines import sys sys.setdefaultencoding('utf-8') into a file called sitecustomize.py in the python search path. On Ubuntu this is /etc/python2.6/sitecustomize.py or whatever, but it could be eg. /usr/lib/python2.6/sitecustomize.py To test, start python and check import sys; sys.getdefaultencoding() Python then deletes (!!) the setdefaultencoding function altogether so it can not be changed at runtime, it's available only on interpreter startup and if sitecustomize.py uses it. Anyway, the code is using 'ignore' to skip over characters; imo that looks a bit bad In [1]: 'ö'.encode('ascii', 'ignore') Out[1]: '' In [2]: 'ö'.encode('ascii', 'replace') Out[2]: '?' Or is there a reason we recode this, why can't we just use utf8 like most normal people? IIRC debian changelogs have to be utf8 nowadays too. After all that typing, I say we just remove the encode() call and use utf-8 across the board ;) -- mjt _______________________________________________ Openmoko community mailing list community@lists.openmoko.org http://lists.openmoko.org/mailman/listinfo/community