Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top


Using Mac OSX 10.6, whether I use or, when I launch Python, I can no longer type accented letters (e.g.é or ä).

Any ideas?

I am using iTerm 0.10.

I would like to type in a string with accented characters (e.g. é) but when I do so at the iTerm prompt, no character appears.

This does not occur in Terminal.

Could someone help me find out what the problem is, and eventually fix it?

EDIT: In, I can use accented characters. However, when I launch the Python 2.71 prompt, I can no longer type in accented characters. When I quit python and return to the terminal prompt, I can again type accented characters.

In iTerm, although I quit Python and restarted iTerm, I cannot type in accented characters (I do not know if I could before).

share|improve this question
The Python prompt? You mean the Python REPL running inside Terminal? – Ignacio Vazquez-Abrams Mar 11 '11 at 2:47
Does no character appear in the terminal at all? Or only when output by a print statement? (e.g. it appears when you enter it) How are you inputting the characters? – Patches Mar 11 '11 at 2:48
@Ignacio: yes, inside the Terminal – Nicojo Mar 11 '11 at 2:53
@Patches: no that is not what I mean. If I try to type print "é", I can actually not type the letter é... – Nicojo Mar 11 '11 at 2:54
But you can type it at the shell prompt? – Dennis Williamson Mar 11 '11 at 2:59
up vote 1 down vote accepted

Possibly a problem with Apple's shipped python, as indicated in the Apple message boards.

share|improve this answer
Thanks for the link! This is indeed exactly my problem: good to know I'm not crazy :) – Nicojo Mar 18 '12 at 15:12

You have to explicitly set the encoding to UTF-8 in your iTerm session. Instructions and helpful thread.

I used to have to do this on old version, I'm not sure if it's default in the newer ones as I haven't used it in some time.

EDIT: I also found this that may be of some help to you.

share|improve this answer
thanks for the suggestion. Unfortunately it doesn't help. I first followed the second link, created a .profile file and restarted iTerm. Then I checked the encoding and it is UTF-8. But I still cannot type é in iTerm. Neither can I do so in when using Python. Any other idea? – Nicojo Mar 11 '11 at 6:22
What's the value of LC_CTYPE? iTerm/iTerm2 won't load a .profile or .bash_profile if your profile/bookmark doesn't specify to use your home directory. In that case, put it in .bashrc. – George Mar 11 '11 at 20:18
@George: Sorry for the late reply; been a bit worried about the situation in Japan, where I currently live. I the LC_CTYPE is UTF-8 in and USA ASCII in iTerm, that is before starting Python (once python launched, locale charmap doesn't work). I've added the .bashrc. This solves the problem with iTerm. But the problem within the python prompt remains... Any idea? – Nicojo Mar 14 '11 at 6:57

The Python problem appears to be a bug/misfeature in Apple's editline library; looks like it's taking Option as the old Unixy Meta behavior, where it sets the high bit on the next character. I don't think this is fixable without replacing Python, unfortunately, unless you want to disable line editing entirely. (And MacPorts' Python does the same thing.)

If you do want to disable line editing, try this.

$ echo 'python: edit off' >> ~/.editrc
share|improve this answer
Well, I'm not sure I understand what you mean: that would be the case if I actually needed to use the Option key, right? But I'm using a Swedish and a Japanese keyboard. The ä is a dedicated key for instance on the swedish keyboard. Sorry if I'm totally misunderstanding... Could you please clarify? – Nicojo Mar 15 '11 at 6:12
That might make things worse; I don't know how editline deals with that, but probably poorly (it dates from back before anyone really cared about internationalization). The edit off thing may still help, though. – geekosaur Mar 15 '11 at 6:17
sorry, didn't do anything... any other idea? – Nicojo Mar 15 '11 at 6:58

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.