Encode differences between idle python and python

Gabriel Genellina gagsl-py at yahoo.com.ar
Tue Oct 10 09:24:52 CEST 2006

At Tuesday 10/10/2006 02:44, pretoriano_2001 at hotmail.com wrote:

>Under win32 XP y select python command line and execute next code with
>results indicated:
>Python 2.5 (r25:51908, Sep 19 2006, 09:52:17) [MSC v.1310 32 bit
>(Intel)] on
>Type "help", "copyright", "credits" or "license" for more information.
> >>> u=u'áéíóú'
> >>> u
> >>> print u
> >>> a=u.encode('latin-1')
> >>> a
> >>> print a
> >>> type(a)
><type 'str'>
> >>> type(u)
><type 'unicode'>
> >>>

Because the console code page != windows code page.
Exit Python. At the console prompt, type:
If it says 850 - your console is using codepage 850.
Enter Python again, and replace 'latin-1' with 
'cp850'. You should get the right representation.

Gabriel Genellina
Softlab SRL 


Preguntá. Respondé. Descubrí. 
Todo lo que querías saber, y lo que ni imaginabas, 
está en Yahoo! Respuestas (Beta). 
¡Probalo ya! 

More information about the Python-list mailing list