[IPython-dev] IPython handles code input as latin1 instead of the system encoding
Fernando Perez
fperez.net at gmail.com
Sun Oct 10 01:29:39 EDT 2010
Hi Eduardo,
On Thu, Jun 17, 2010 at 2:28 PM, Eduardo Habkost <ehabkost at raisama.net> wrote:
>
> Hi,
>
> I just noticed a problem with non-ascii input in ipython, that can be
> seen below:
>
> Python behavior (expected):
>
> ---------
> $ python
> Python 2.6 (r26:66714, Nov 3 2009, 17:33:38)
> [GCC 4.4.1 20090725 (Red Hat 4.4.1-2)] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
>>>> import sys, locale
>>>> print sys.stdin.encoding,locale.getdefaultlocale()
> UTF-8 ('en_US', 'UTF8')
>>>> print repr(u'áé')
> u'\xe1\xe9'
> -------------
> (two unicode characters as result, as expected)
>
>
> IPython behavior:
>
> ------------------
> $ ipython
> Python 2.6 (r26:66714, Nov 3 2009, 17:33:38)
> Type "copyright", "credits" or "license" for more information.
>
> IPython 0.11.alpha1.git -- An enhanced Interactive Python.
> ? -> Introduction and overview of IPython's features.
> %quickref -> Quick reference.
> help -> Python's own help system.
> object? -> Details about 'object'. ?object also works, ?? prints more.
>
> In [1]: import sys, locale
>
> In [2]: print sys.stdin.encoding,locale.getdefaultlocale()
> UTF-8 ('en_US', 'UTF8')
>
> In [3]: print repr(u'áé')
> u'\xc3\xa1\xc3\xa9'
Thanks for the report. We've made a lot of improvements to our
unicode handling recently, and I think it's all OK now. With current
trunk:
IPython 0.11.alpha1.git -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
object? -> Details about 'object', use 'object??' for extra details.
In [1]: import sys, locale
In [2]: print repr(u'áé')
u'\xe1\xe9'
Let us know again if you have any remaining problems.
Cheers,
f
More information about the IPython-dev
mailing list