Fix of issue 2253 in trunk

svn: r10861
This commit is contained in:
Peter Landgren 2008-07-14 18:56:39 +00:00
parent 6a69166ae8
commit 7b9a2713ba

View File

@ -259,8 +259,10 @@ def breakup(txt, limit):
data = []
while len(txt) > limit:
# look for non-space pair to break between
# do not break within a UTF-8 byte sequence, i. e. first char >127
idx = limit
while idx>0 and (txt[idx-1].isspace() or txt[idx].isspace()):
while (idx>0 and (txt[idx-1].isspace() or txt[idx].isspace()
or ord(txt[idx-1]) > 127)):
idx -= 1
if idx == 0:
#no words to break on, just break at limit anyway