URL string

All ESP32 boards running MicroPython.
Target audience: MicroPython users with an ESP32 board.
Post Reply
User avatar
Posts: 38
Joined: Fri Jun 29, 2018 12:32 am

URL string

Post by MorseIot » Tue May 21, 2019 11:43 pm

How do I convert url string to string, example:

receive request:

Code: Select all

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


User avatar
Posts: 1904
Joined: Tue Aug 08, 2017 1:57 am
Location: Sydney, Australia

Re: URL string

Post by jimmo » Wed May 22, 2019 1:27 am

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.

Post Reply