I wrote a script which first starts in AP mode, asks the user to enter ssid and pasword for the wifi in web form then after restart it starts in station mode and connects to the wifi. Everything works fine, except one thing.
When I enter special characters like "!, ', @", etc. the sockets receives them as HTML code.
For example, when I enter "Cemo" as the "Wifi Name" in the text box and "micro1234!!" for the password, what esp32 receives "micro1234%21&21" as the password. HTML encoding for "!" is %21.
This is true for other characters as well (i.e. "@, ^", etc.)
I know this question is probably not directly related to micropython, but it is quite annoying and I could not find a solution yet.
Code: Select all
b'GET /action_page.php?ssid=Cemo&pwrd=micro1234%21%21 HTTP/1.1\r\nHost: 192.168.4.1\r\n
Code: Select all
def web_page():
html = """
<!DOCTYPE html>
<head>
<style>
body {
background-color: lightblue;
}
h2 {
color: white;
text-align: center;
}
.clabel {
font-family: verdana;
font-size: 20px;
}
label {
width:240px;
display:inline-block;
}
</style>
</head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<html>
<body>
<h2 style="background-color: DodgerBlue;font-family: verdana;">Enter Your Wifi Router Details</h2>
<form enctype="text/plain" action="/action_page.php">
<label class="clabel" for="ssid">Wifi name (SSID):</label>
<input type="text" id="ssidID" name="ssid" value="" placeholder="WIFI name"><br><br>
<label class="clabel" for="pwrd">Password:</label>
<input type="text" id="pwrdID" name="pwrd" value="" placeholder="Password"><br><br>
<input class="clabel" type="submit" value="Submit">
</form>
</body>
</html>
"""
return html