Am 19.11.15 um 08:54 schrieb Ulli Horlacher:
Christian Gollwitzer <aurio...@gmx.de> wrote:
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.
encode("hex") works only with binary strings?
How do I convert a UTF8 string to binary?
It's right in the other line I showed you:
Apfelkiste:Tests chris$ python
Python 2.7.2 (default, Oct 11 2012, 20:14:37)
[GCC 4.2.1 Compatible Apple Clang 4.0 (tags/Apple/clang-418.0.60)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> u"blablüa".encode('utf8')
'blabl\xc3\xbca'
>>>
Christian
--
https://mail.python.org/mailman/listinfo/python-list