utf-8 in interactive python session

Discussion in 'Python' started by Luke, Sep 30, 2004.

  1. Luke

    Luke Guest

    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.
    >>> 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'
    >>>
     
    Luke, Sep 30, 2004
    #1
    1. Advertising

  2. Luke

    Guest Guest

    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 <> wrote:
    > 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.
    > >>> 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'
    > >>>
     
    Guest, Sep 30, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. JJBW
    Replies:
    1
    Views:
    10,362
    Joerg Jooss
    Apr 24, 2004
  2. =?Utf-8?B?QXNoYQ==?=
    Replies:
    3
    Views:
    447
  3. WJ
    Replies:
    2
    Views:
    515
  4. Arifi Koseoglu
    Replies:
    2
    Views:
    1,009
    Arifi Koseoglu
    Apr 13, 2004
  5. Grzegorz ¦liwiñski
    Replies:
    2
    Views:
    989
    Grzegorz ¦liwiñski
    Jan 19, 2011
Loading...

Share This Page