Am 18.11.15 um 17:45 schrieb Ulli Horlacher:
This is my encoding function:

def url_encode(s):
   u = ''
   for c in list(s):
     if match(r'[_=:,;<>()+.\w\-]',c):
       u += c
     else:
       u += '%' + c.encode("hex").upper()
   return u



The quoting is applied to a UTF8 string. But I think you shouldn't do it yourself, use a library function:

import urllib
urllib.quote(yourstring.encode('utf8'))

        Christian
--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to