Yet another unicode WTF

Ben Finney ben+python at
Thu Jun 4 22:06:27 EDT 2009

Ron Garret <rNOSPAMon at> writes:

> Python 2.6.2 on OS X 10.5.7:
> [ron at mickey:~]$ echo $LANG
> en_US.UTF-8
> [ron at mickey:~]$ cat 
> #!/usr/bin/env python
> print u'\u03BB'
> [ron at mickey:~]$ ./ 
> ª
> [ron at mickey:~]$ ./ > foo
> Traceback (most recent call last):
>   File "./", line 2, in <module>
>     print u'\u03BB'
> UnicodeEncodeError: 'ascii' codec can't encode character u'\u03bb' in 
> position 0: ordinal not in range(128)

I get the same behaviour on Debian GNU/Linux, python 2.5.2. It's
certainly not desirable; the terminal, the shell, and the filesystem are
all using UTF-8 so it should work fine.

You might be best advised to report this as a bug to the Python bug
tracker <URL:>.

 \        “I fly Air Bizarre. You buy a combination one-way round-trip |
  `\    ticket. Leave any Monday, and they bring you back the previous |
_o__)     Friday. That way you still have the weekend.” —Steven Wright |
Ben Finney

More information about the Python-list mailing list