[Python-Dev] Python code.interact() and UTF-8 locale

Hye-Shik Chang hyeshik at gmail.com
Tue Sep 13 10:56:32 CEST 2005


On 9/11/05, Victor STINNER <victor.stinner-linux at haypocalc.com> wrote:
> Hi,
> 
> I found a bug in Python interactive command line (program python alone:
> looks to be code.interact() function in code.py). With UTF-8 locale, the
> command << u"é" >> returns << u'\xc3\xa9' >> and not << u'\xE9' >>.
> Remember: the french e with acute is Unicode 233 (0xE9), encoded \xC3
> \xA9 in UTF-8.

Which version of python do you use?  From 2.4, the interactive mode
respects locale as a source code encoding and it falls back to latin-1
when decoding fails.

Python 2.4.1 (#2, Jul 31 2005, 04:45:53)
[GCC 3.4.2 [FreeBSD] 20040728] on freebsd5
Type "help", "copyright", "credits" or "license" for more information.
>>> u"é"
u'\xe9'


Hye-Shik


More information about the Python-Dev mailing list