utf-8 in interactive python session

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Luke

    #1

    utf-8 in interactive python session

    Python doesn't seem to read UTF-8 properly from an interactive
    session. Am I doing something wrong?

    luked@sor ~ $ echo $LANG
    en_AU.UTF-8
    luked@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.[color=blue][color=green][color=darkred]
    >>> import sys
    >>> print sys.getdefaulte ncoding()[/color][/color][/color]
    utf-8[color=blue][color=green][color=darkred]
    >>> u'π' # embedded greek letter 'pi' (possibly mangled by[/color][/color][/color]
    google groups news client), should return u'\u03c0'
    u'\xcf\x80'[color=blue][color=green][color=darkred]
    >>> u'\u03c0'.encod e()[/color][/color][/color]
    '\xcf\x80'[color=blue][color=green][color=darkred]
    >>>[/color][/color][/color]
  • Guest's Avatar

    #2
    Re: utf-8 in interactive python session

    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@deller.id .au> wrote:[color=blue]
    > Python doesn't seem to read UTF-8 properly from an interactive
    > session. Am I doing something wrong?
    >
    > luked@sor ~ $ echo $LANG
    > en_AU.UTF-8
    > luked@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.[color=green][color=darkred]
    > >>> import sys
    > >>> print sys.getdefaulte ncoding()[/color][/color]
    > utf-8[color=green][color=darkred]
    > >>> u'π' # embedded greek letter 'pi' (possibly mangled by[/color][/color]
    > google groups news client), should return u'\u03c0'
    > u'\xcf\x80'[color=green][color=darkred]
    > >>> u'\u03c0'.encod e()[/color][/color]
    > '\xcf\x80'[color=green][color=darkred]
    > >>>[/color][/color][/color]

    Comment

    Working...