[ python-Bugs-1436532 ] length of unicode string changes print behaviour

SourceForge.net noreply at sourceforge.net
Mon Mar 6 02:44:58 CET 2006


Bugs item #1436532, was opened at 2006-02-22 04:45
Message generated for change (Comment added) made by tjreedy
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: Kurt B. Kaiser (kbk)
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: 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