Do not cut a string within an utf-8 sequence.

svn: r14205
This commit is contained in:
Peter Landgren 2010-02-04 07:29:42 +00:00
parent 8b6077a95e
commit 2f2fdeded8

View File

@ -79,7 +79,7 @@ except ImportError:
gender = { gender = {
gen.lib.Person.MALE : _("male"), gen.lib.Person.MALE : _("male"),
gen.lib.Person.FEMALE : _("female"), gen.lib.Person.FEMALE : _("female"),
gen.lib.Person.UNKNOWN : _("unknown"), gen.lib.Person.UNKNOWN : _("gender|unknown"),
} }
def format_gender( type): def format_gender( type):
@ -1377,6 +1377,9 @@ def navigation_label(db, nav_type, handle):
if obj: if obj:
label = obj.get() label = obj.get()
label = " ".join(label.split()) label = " ".join(label.split())
# When strings are cut, make sure they are unicode
#otherwise you may end of with cutting within an utf-8 sequence
label = unicode(label)
if len(label) > 40: if len(label) > 40:
label = label[:40] + "..." label = label[:40] + "..."