Author tzot
Recipients christian.heimes, ezio.melotti, haypo, mark, pitrou, tzot
Date 2009-05-19.00:08:57
SpamBayes Score 1.66533e-16
Marked as misclassified No
Message-id <1242691745.04.0.661409156689.issue1602@psf.upfronthosting.co.za>
In-reply-to
Content
Just in case it helps, this behaviour is on Win XP Pro, Python 2.5.1:

First, I added an alias for 'cp65001' to 'utf_8' in
Lib/encodings/aliases.py .

Then, I opened a command prompt with a bitmap font.

c:\windows\system32>python
Python 2.5.1 (r251:54863, Apr 18 2007, 08:51:08) [MSC v.1310 32 bit
(Intel)] on
win32
Type "help", "copyright", "credits" or "license" for more information.
>>> print u"\N{EM DASH}"
—

I switched the font to Lucida Console, and retried (without exiting the
python interpreter, although the behaviour is the same when exiting and
entering again: )

>>> print u"\N{EM DASH}"
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
IOError: [Errno 13] Permission denied

Then I tried (by pressing Alt+0233 for é, which is invalid in my normal
cp1253 codepage):

>>> print u"née"

and the interpreter exits without any information. So it does for:

>>> a=u"née"

Then I created a UTF-8 text file named 'test65001.py':

# -*- coding: utf_8 -*-
a=u"néeα"
print a

and tried to run it directly from the command line:

c:\windows\system32>python d:\src\PYTHON\test65001.py
néeαTraceback (most recent call last):
  File "d:\src\PYTHON\test65001.py", line 4, in <module>
    print a
IOError: [Errno 2] No such file or directory

You see? It printed all the characters before failing.

Also the following works:

c:\windows\system32>echo heéε
heéε

and

c:\windows\system32>echo heéε >D:\src\PYTHON\dummy.txt

creates successfully a UTF-8 file (without any UTF-8 BOM marks at the
beginning).

So it's possible that it is a python bug, or at least something can be
done about it.
History
Date User Action Args
2009-05-19 00:09:06tzotsetrecipients: + tzot, pitrou, haypo, christian.heimes, mark, ezio.melotti
2009-05-19 00:09:05tzotsetmessageid: <1242691745.04.0.661409156689.issue1602@psf.upfronthosting.co.za>
2009-05-19 00:09:03tzotlinkissue1602 messages
2009-05-19 00:08:58tzotcreate