str() should convert ANY object to a string without EXCEPTIONS !

Olivier Lauzanne nevare.stark at
Sun Sep 28 12:01:12 CEST 2008

On Sep 28, 11:21 am, est <electronix... at> wrote:
> On Sep 28, 4:38 pm, Steven D'Aprano <st... at REMOVE-THIS-
> Can anyone tell me how to customize a default encoding, let's say
> 'ansi' which handles range(256) ?

I assume you are using python2.5
Edit the file /usr/lib/python2.5/

There is a method called
def setencoding():
    encoding = "ascii"

Change "encoding = "ascii" to encoding = "utf-8"

On windows you may have to use "mbsc" or something like that. I have
no idea what windows use at its encoding.

As long as all systems don't use the same encoding (let's say utf-8
since it is becoming the standard on unixes and on the web) using
ascii as a default encoding makes sense.

More information about the Python-list mailing list