def utf8_text(text):
 if (text and text.strip()):
  text = text.strip()
  if (not isinstance(text, unicode)):
   text = text.decode(u'utf-8', u'replace')
  text = normalize(text).encode(u'utf-8')
 else:
  text = _(u'Unknown').encode(u'utf-8')
 return text

def utf8_text ( text ) : if ( text and text . strip ( ) ) : text = text . strip ( ) if ( not isinstance ( text , unicode ) ) : text = text . decode ( u'utf-8' , u'replace' ) text = normalize ( text ) . encode ( u'utf-8' ) else : text = _ ( u'Unknown' ) . encode ( u'utf-8' ) return text
convert a possibly null string to utf-8 bytes .