def xml_to_unicode(raw, verbose=False, strip_encoding_pats=False, resolve_entities=False, assume_utf8=False):
 if (not raw):
  return (u'', None)
 (raw, encoding) = detect_xml_encoding(raw, verbose=verbose, assume_utf8=assume_utf8)
 if (not isinstance(raw, unicode)):
  raw = raw.decode(encoding, u'replace')
 if strip_encoding_pats:
  raw = strip_encoding_declarations(raw)
 if resolve_entities:
  raw = substitute_entites(raw)
 return (raw, encoding)

def xml_to_unicode ( raw , verbose = False , strip_encoding_pats = False , resolve_entities = False , assume_utf8 = False ) : if ( not raw ) : return ( u'' , None ) ( raw , encoding ) = detect_xml_encoding ( raw , verbose = verbose , assume_utf8 = assume_utf8 ) if ( not isinstance ( raw , unicode ) ) : raw = raw . decode ( encoding , u'replace' ) if strip_encoding_pats : raw = strip_encoding_declarations ( raw ) if resolve_entities : raw = substitute_entites ( raw ) return ( raw , encoding )
force conversion of byte string to unicode .