[ python-Bugs-1436532 ] length of unicode string changes print behaviour
SourceForge.net
noreply at sourceforge.net
Sun Jul 23 07:33:26 CEST 2006
Bugs item #1436532, was opened at 2006-02-22 04:45
Message generated for change (Comment added) made by kbk
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1436532&group_id=5470
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: IDLE
Group: Python 2.4
Status: Open
Resolution: None
Priority: 5
Submitted By: James (hover_boy)
>Assigned to: Martin v. Löwis (loewis)
Summary: length of unicode string changes print behaviour
Initial Comment:
Python 2.4.2 and IDLE (with Courier New font) on XP
and the following code saved as a UTF-8 file
if __name__ == "__main__":
print "é¶ ä¸ äº ä¸ å äº å
ä¸ å
«"
print "é¶ ä¸ äº ä¸ å äº å
ä¸ å
« ä¹ å "
results in...
IDLE 1.1.2
>>> ================================ RESTART
================================
>>>
éâºÂ¶ ä¸⬠亊ä¸Ⱐåâºâº äºâ Ã¥â¦Ã¤Â¸Æ Ã¥â¦Â«
é¶ ä¸ äº ä¸ å äº å
ä¸ å
« ä¹ å
>>>
----------------------------------------------------------------------
>Comment By: Kurt B. Kaiser (kbk)
Date: 2006-07-23 01:33
Message:
Logged In: YES
user_id=149084
I don't have a font installed which will print
those characters. When I load your sample file,
I see print statements which include unicode
characters like \u5341. The printed output
contains the same unicode characters as the
input program. Maybe Martin has an idea.
----------------------------------------------------------------------
Comment By: James (hover_boy)
Date: 2006-03-22 10:21
Message:
Logged In: YES
user_id=1458491
I've attached an example file to demonstrate the problem
better.
it seems not to be the length but something else which I
haven't figured out yet.
I've also added the encoding comment and also tried
changing the default encoding in sitecustomize.py from latin
-1 to utf-8 but neither seem to work.
thanks,
James.
XP professional, SP2, english
----------------------------------------------------------------------
Comment By: James (hover_boy)
Date: 2006-03-22 10:12
Message:
Logged In: YES
user_id=1458491
----------------------------------------------------------------------
Comment By: Terry J. Reedy (tjreedy)
Date: 2006-03-05 20:44
Message:
Logged In: YES
user_id=593130
I am fairly ignorant of unicode and encodings, but I am
surprised you got anything coherent without an encoding
cookie comment at the top (see manual). Have you tried
that? Other questions that might help someone answer:
What specific XP version? SP2 installed? Country version?
Your results for
>>> sys.getdefaultencoding()
'ascii'
>>> sys.getfilesystemencoding()
'mbcs'
What happens if you reverse the order of the print
statements? (Ie, is it really the shorter string that
does not work or just the first?)
I don't know enough to know if this is really a bug. If
you don't get an answer here, you might try for more info
on python-list/comp.lang.python
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1436532&group_id=5470
More information about the Python-bugs-list
mailing list