File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -709,6 +709,14 @@ def test_render_author_name(self):
709709 )),
710710 "Joanna Q. Public" ,
711711 )
712+ self .assertEqual (
713+ XMLDraft .render_author_name (lxml .etree .Element (
714+ "author" ,
715+ fullname = chr (340 )+ "ich" ,
716+ asciiFullname = "Rich UTF-8" ,
717+ )),
718+ chr (340 )+ "ich (Rich UTF-8)" ,
719+ )
712720 self .assertEqual (
713721 XMLDraft .render_author_name (lxml .etree .Element (
714722 "author" ,
Original file line number Diff line number Diff line change @@ -233,6 +233,12 @@ def render_author_name(author_elt):
233233 # Use fullname attribute, if present
234234 fullname = author_elt .attrib .get ("fullname" , "" ).strip ()
235235 if fullname :
236+ # If any 8bit chars in the fullname, try to append the author's
237+ # name in ascii.
238+ if any ([x >= 0x80 for x in fullname .encode ('utf8' )]):
239+ asciifullname = author_elt .attrib .get ("asciiFullname" , "" ).strip ()
240+ if asciifullname :
241+ fullname = fullname + ' (' + asciifullname + ')'
236242 return fullname
237243 surname = author_elt .attrib .get ("surname" , "" ).strip ()
238244 initials = author_elt .attrib .get ("initials" , "" ).strip ()
You can’t perform that action at this time.
0 commit comments