You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
According to the docs body string in HTTP response should be encoded in UTF-8 but the response cant handle special characters like "ÅÄÖ". This is the code im using:
app = Microdot()
htmldoc = '''<!DOCTYPE html>
<html>
<head>
<title>Microdot Example Page</title>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
</head>
<body>
<div>
<h1>Microdot Example Page</h1>
<p>Test åöä</p>
<p><a href="/shutdown">Click to shutdown the server</a></p>
<form action="/form" method="POST" accept-charset="utf-8">
<label for="ssid">SSID:</label><br>
<input type="text" id="ssid" name="ssid"><br>
<label for="password">Password:</label><br>
<input type="password" id="password" name="password"><br>
<input type="submit" value="Submit">
</form>
</div>
</body>
</html>
'''
@app.route('/')
def hello(request):
return htmldoc, 200, {'Content-Type': 'text/html'}
@app.route('/form', methods=['GET', 'POST'])
def index(req):
if req.method == 'POST':
print(req.form.get('ssid')) # <-- This outputs Lös if the given value is Lös
ssid = req.form.get('ssid')
password = req.form.get('password')
print(ssid) # <-- This outputs Lös if the given value is Lös
print(password) # <-- This outputs Lös if the given value is Lös
return f'SSID: {ssid}, Password: {password}' # <-- This outputs Lös if the given value is Lös
The text was updated successfully, but these errors were encountered:
@WattageGuy This is actually a problem on my part. I documented how I intended this to work, but it appears I haven't implemented this fully. Fix coming soon.
According to the docs body string in HTTP response should be encoded in UTF-8 but the response cant handle special characters like "ÅÄÖ". This is the code im using:
The text was updated successfully, but these errors were encountered: