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

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Tue Sep 30 03:15:45 EDT 2008


En Sun, 28 Sep 2008 07:01:12 -0300, Olivier Lauzanne  
<nevare.stark at gmail.com> escribió:
> On Sep 28, 11:21 am, est <electronix... at gmail.com> wrote:

>> 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/site.py
>
> 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.

*Not* a good idea at all.
You're just masking errors, and making your programs incompatible with all  
other Pythons installed around the world.

-- 
Gabriel Genellina




More information about the Python-list mailing list