def uni2html(u):
 htmlentities = list()
 for c in u:
  ord_c = ord(c)
  if (ord_c < 128):
   if (ord_c > 31):
    htmlentities.append(c)
  else:
   try:
    htmlentities.append(('&%s;' % codepoint2name[ord_c]))
   except KeyError:
    pass
 return ''.join(htmlentities)

def uni2html ( u ) : htmlentities = list ( ) for c in u : ord_c = ord ( c ) if ( ord_c < 128 ) : if ( ord_c > 31 ) : htmlentities . append ( c ) else : try : htmlentities . append ( ( '&%s;' % codepoint2name [ ord_c ] ) ) except KeyError : pass return '' . join ( htmlentities )
convert unicode to html .