Skip to content
This repository

ipython change char '0xe9' to 4 spaces #58

Closed
ipython opened this Issue · 15 comments

4 participants

IPython: interactive computing in Python 夏恺(Xia Kai) Thomas Kluyver haosdent
IPython: interactive computing in Python
ipython commented

Original Launchpad bug 328942: https://bugs.launchpad.net/ipython/+bug/328942
Reported by: lidaobing (LI Daobing).

Binary package hint: ipython

How to reproduce:

  1. start a terminal support unicode (such as gnome-terminal or mlterm)

  2. start ipython, then run "print unichr(0x9000)", the output in terminal should like:

In [1]: print unichr(0x9000)
退

  1. copy this character ("退") and paste it to ipython again (after "In [2]:"), then press enter, ipython will quit.

change 0x9000 to 0x8fff, ipython will not crash. change 0x9000 to other number bigger than 0x9000, ipython will also crash (I test many number, but not all, :-)

python don't have this bug.

this bug can be reproduce in gnome-terminal and mlterm.

ProblemType: Bug
Architecture: i386
DistroRelease: Ubuntu 8.10
Package: ipython 0.8.4-1
PackageArchitecture: all
ProcEnviron:
PATH=/home/username/.local/bin:/home/username/bin:/home/username/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
LANG=en_US.UTF-8
SHELL=/bin/bash
SourcePackage: ipython
Uname: Linux 2.6.27-7-generic i686

IPython: interactive computing in Python
ipython commented

[ LP comment 1 by: LI Daobing, on 2009-02-13 07:24:47.971268+00:00 ]

IPython: interactive computing in Python
ipython commented

[ LP comment 2 by: LI Daobing, on 2009-02-13 07:48:43.619610+00:00 ]

this bug also exist in ipython 0.9.1

IPython: interactive computing in Python
ipython commented

[ LP comment 3 by: Fernando Perez, on 2009-03-14 13:01:17.900891+00:00 ]

At least on my trunk, it looks fine:

uqbar[scratch]> python
Python 2.5.2 (r252:60911, Oct 5 2008, 19:29:17)
[GCC 4.3.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.

print unichr(0x9000)
退

uqbar[scratch]> ip -nobanner

In [1]: print unichr(0x9000)
退

Closing for now, reopen if you have further info using my trunk:
https://code.launchpad.net/~fdo.perez/ipython/trunk-dev

(this will be soon merged for release, once it's reviewed by others).

IPython: interactive computing in Python
ipython commented

[ LP comment 4 by: LI Daobing, on 2009-03-14 17:58:54.631789+00:00 ]

another way to reproduce this bug

  1. change your terminal encoding to ISO8859-1
  2. change your locale to en_US.ISO8859-1
  3. run ipython
  4. input or paste "é" (0xe9 in iso8859-1) to your ipython interactive line, then you will find it have been change to 4 spaces " "
  5. the nearby character do not have this bug: for example: è (0xe8), or ê(0xea)

thanks.

IPython: interactive computing in Python
ipython commented

[ LP comment 5 by: Fernando Perez, on 2009-03-15 22:58:02.269438+00:00 ]

OK, I see it now. In fact, I don't even have to change my locale, just the terminal encoding (at least on gnome-terminal).

I'm marking it as confirmed but assigned to nobody, because honestly I don't know how to fix it right now, and I have other things on my plate that are more urgent for me. We have others on the team that know much, much more about unicode than I do, so perhaps one of them can help. And if you do find a solution, please send it in, it would be very nice to have this fixed.

Sorry not to be able to help more right now.

夏恺(Xia Kai)
xiaket commented

I can repeat this bug on a linux box running ipython 0.10. Hope someone would fix it.

Thomas Kluyver
Collaborator

Interesting. If it helps anyone, the range of characters concerned have the first byte /xe9 in utf-8.

Thomas Kluyver
Collaborator

Disable readline \M-i, so characters 0x9000-0x9fff don't crash IPython.

closed by c709d8b

Brian E. Granger ellisonbg referenced this issue from a commit
Commit has since been removed from the repository and is no longer available.
haosdent

Hi, how could I "Disable readline \M-i", the version of my ipython is 0.13.2

Thomas Kluyver
Collaborator

It should be disabled by default in that version. Check c.TerminalInteractiveShell.readline_parse_and_bind in your ipython_config.py file. You might also want to check your .inputrc file, because IPython can use that as well.

haosdent

I couldn't find "c.TerminalInteractiveShell.readline_parse_and_bind" in all "ipython_config.py" files under "/Library/Python/2.7/site-packages/ipython-0.13.2-py2.7.egg/IPython/config/profile". I don't have ".inputrc" file and other ipython profiles in my home folder. But I still couldn't type Chinese in ipython.

Thomas Kluyver
Collaborator
haosdent

I could type Chinese in termial normally. And I couldn't any profile files in "~/.ipython" folder. In mac, "~/.config" isn't exist.

haosdent

Thank you very much. I found that I could solve this by "export LC_ALL="en_US.UTF-8"".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.