utf-8 in interactive python session

hyeshik at gmail.com hyeshik at gmail.com
Thu Sep 30 03:10:40 EDT 2004


The problem is fixed in Python 2.4a2 and its later versions.
Please try one of them. :)

Hye-Shik

On 29 Sep 2004 23:36:48 -0700, Luke <luke at deller.id.au> wrote:
> Python doesn't seem to read UTF-8 properly from an interactive
> session.  Am I doing something wrong?
> 
> luked at sor ~ $ echo $LANG
> en_AU.UTF-8
> luked at sor ~ $ python
> Python 2.3.4 (#1, Aug 12 2004, 17:23:54)
> [GCC 3.4.1  (Gentoo Linux 3.4.1, ssp-3.4-2, pie-8.7.6.3)] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
> >>> import sys
> >>> print sys.getdefaultencoding()
> utf-8
> >>> u'π'  # embedded greek letter 'pi' (possibly mangled by
> google groups news client), should return u'\u03c0'
> u'\xcf\x80'
> >>> u'\u03c0'.encode()
> '\xcf\x80'
> >>>



More information about the Python-list mailing list