
gagsl-py at yahoo
Oct 10, 2006, 12:24 AM
Post #3 of 5
(105 views)
Permalink
|
|
Re: Encode differences between idle python and python
[In reply to]
|
|
At Tuesday 10/10/2006 02:44, pretoriano_2001 [at] hotmail wrote: >Hello: >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 >u'\xe1\xe9\xed\xf3\xfa' > >>> print u >áéíóú > >>> a=u.encode('latin-1') > >>> a >'\xe1\xe9\xed\xf3\xfa' > >>> 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: >chcp 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! http://www.yahoo.com.ar/respuestas -- http://mail.python.org/mailman/listinfo/python-list
|