idle 2.x and unicode literals

Discussion in 'Python' started by Joe P. Cool, Apr 2, 2010.

  1. Joe P. Cool

    Joe P. Cool Guest

    Hi,

    I'm working with Python 2.6.4 on Ubuntu 9.10 and noticed a difference
    between IDLE and command line python. If I enter an é (accented e,
    LATIN SMALL LETTER E WITH ACUTE) as a unicode string in command line
    python I get this:
    u'\xe9'

    In IDLE 2.6.4 I get this:
    u'\xc3\xa9'

    IDLE is set to UTF-8 and console environment has LANG = en_US.UTF-8.
    This is a bit annyoing because ord(u'é') works on the command line but
    raises an exception in IDLE:
    Traceback (most recent call last):
    File "<pyshell#7>", line 1, in <module>
    ord(u'é')
    TypeError: ord() expected a character, but string of length 2 found

    Is this a bug? IDLE 3.1.1 works.

    Cheers,
    Joe
     
    Joe P. Cool, Apr 2, 2010
    #1
    1. Advertisements

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.