def _encode(s):
 if isinstance(s, unicode):
  for (char, repl) in URL_CHARACTERS.items():
   s = s.replace(char, repl)
  s = s.encode('utf8', 'ignore')
 return urllib.quote(s)

def _encode ( s ) : if isinstance ( s , unicode ) : for ( char , repl ) in URL_CHARACTERS . items ( ) : s = s . replace ( char , repl ) s = s . encode ( 'utf8' , 'ignore' ) return urllib . quote ( s )
encode a single character .