Yet another unicode WTF

Ben Finney ben+python at benfinney.id.au
Fri Jun 5 04:06:27 CEST 2009


Ron Garret <rNOSPAMon at flownet.com> writes:

> Python 2.6.2 on OS X 10.5.7:
> 
> [ron at mickey:~]$ echo $LANG
> en_US.UTF-8
> [ron at mickey:~]$ cat frob.py 
> #!/usr/bin/env python
> print u'\u03BB'
> 
> [ron at mickey:~]$ ./frob.py 
> ª
> [ron at mickey:~]$ ./frob.py > foo
> Traceback (most recent call last):
>   File "./frob.py", 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:http://bugs.python.org/>.

-- 
 \        “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