String must be unicode for truncation to work for non ascii characters.

svn: r13168
This commit is contained in:
Peter Landgren 2009-09-08 07:28:23 +00:00
parent 5b2ed0dafa
commit 9991df71e8

View File

@ -311,6 +311,8 @@ class ScratchPadNote(ScratchPadWrapper):
self._title = value.get_gramps_id() self._title = value.get_gramps_id()
note = value.get().replace('\n', ' ') note = value.get().replace('\n', ' ')
#String must be unicode for truncation to work for non ascii characters
note = unicode(note)
if len(note) > 80: if len(note) > 80:
self._value = note[:80]+"..." self._value = note[:80]+"..."
else: else:
@ -481,6 +483,8 @@ class ScratchPadSourceRef(ScratchPadGrampsTypeWrapper):
text = "" text = ""
if len(srctxtlist) > 0: if len(srctxtlist) > 0:
text = " ".join(srctxtlist[0].get().split()) text = " ".join(srctxtlist[0].get().split())
#String must be unicode for truncation to work for non ascii characters
text = unicode(text)
if len(text) > 60: if len(text) > 60:
text = text[:60]+"..." text = text[:60]+"..."
self._value = _("Volume/Page: %(pag)s -- %(sourcetext)s") % { self._value = _("Volume/Page: %(pag)s -- %(sourcetext)s") % {