From 2f2fdeded8a757058c1198f181a0e5825be9a313 Mon Sep 17 00:00:00 2001 From: Peter Landgren Date: Thu, 4 Feb 2010 07:29:42 +0000 Subject: [PATCH] Do not cut a string within an utf-8 sequence. svn: r14205 --- src/Utils.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Utils.py b/src/Utils.py index 0ab172fa2..506356b21 100644 --- a/src/Utils.py +++ b/src/Utils.py @@ -79,7 +79,7 @@ except ImportError: gender = { gen.lib.Person.MALE : _("male"), gen.lib.Person.FEMALE : _("female"), - gen.lib.Person.UNKNOWN : _("unknown"), + gen.lib.Person.UNKNOWN : _("gender|unknown"), } def format_gender( type): @@ -1377,6 +1377,9 @@ def navigation_label(db, nav_type, handle): if obj: label = obj.get() 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: label = label[:40] + "..."