def platform_encode(p):
 if isinstance(p, str):
  try:
   return p.decode('utf-8')
  except:
   return p.decode(codepage, errors='replace').replace('?', '!')
 else:
  return p

def platform_encode ( p ) : if isinstance ( p , str ) : try : return p . decode ( 'utf-8' ) except : return p . decode ( codepage , errors = 'replace' ) . replace ( '?' , '!' ) else : return p
return unicode name .