Page 1 of 1

URL string

Posted: Tue May 21, 2019 11:43 pm
by MorseIot
How do I convert url string to string, example:

receive request:

Code: Select all

request = conn.recv(1024)
print(request)
result: %23%24%25%26%40%40
should be: #$%&@@

Tx

Re: URL string

Posted: Wed May 22, 2019 1:27 am
by jimmo
Looks like you're talking about URL escaping (or encoding).

Maybe take a look at using https://github.com/micropython/micropyt ... b/parse.py

It's relatively straightforward to do the transformation yourself %xx --> int(xx, 16).

But fom your example I can't tell if you're parsing a query string (i.e. it's made up of &-separated name=value pairs) or you just want to decode a single url-escaped value.