def urlquote(s, safe='/'): if isinstance(s, _real_unicode): # Pretend to be py3 by encoding the URI automatically. s = s.encode('utf8') return _urlquote(s, safe)
def urlquote(text): """Fixup wrapper to make C{urllib.quote} behave as in Python 3""" return _urlquote(text if isinstance(text, bytes) else text.encode('utf-8'))
def urlquote(string, safe=b'/'): if not isinstance(safe, bytes): safe = safe.encode('ascii', 'ignore') if not isinstance(string, bytes): string = string.encode('utf8') return _urlquote(string, safe)