Bug in Python 2.4 raw_input(u'xyz') Win/command line?

Petr Prikryl Prikryl at skil.cz
Mon Jan 10 04:54:43 EST 2005


Hi,

Could you test the following example for your
non-English language with accented characters?

I have observed a problem when running 
Python 2.4, Windows version (python-2.4.msi)
and using raw_input() with unicode prompt
string in a console program (ran in the DOS window).

I do use the following sitecustomize file to set
the default encoding:

sitecustomize.py
=================================
import sys
sys.setdefaultencoding('cp1250')
=================================


test.py
=================================
# -*- coding: cp1250 -*-
s = u'string with accented letters'
print s         # OK
val = raw_input(s)    # s displayed differently (wrong)
=================================

... when run in a DOS window. See the attached
test.png. The "type test.py" displays the string
definition also wrong, because the DOS window
uses different encoding than cp1250. The print
command prints the string correctly, converting
the internal unicode string to the encoding that
the is defined by the output environment. However,
the raw_input() probably does convert the unicode
string to the cp1250 and does not do the same
(more clever) thing that the print does.

Could you confirm the bug? Is it known?
Should this be posted into some bug-report list?

Petr


python test.py

I have observed t

-- 
Petr Prikryl (prikrylp at skil dot cz) 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test.py
Type: application/octet-stream
Size: 172 bytes
Desc: test.py
URL: <http://mail.python.org/pipermail/python-list/attachments/20050110/384c6326/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test.png
Type: image/png
Size: 3689 bytes
Desc: test.png
URL: <http://mail.python.org/pipermail/python-list/attachments/20050110/384c6326/attachment.png>


More information about the Python-list mailing list