Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wifi password can't handle special chacter #37

Open
Kugeleis opened this issue Oct 7, 2023 · 3 comments
Open

wifi password can't handle special chacter #37

Kugeleis opened this issue Oct 7, 2023 · 3 comments

Comments

@Kugeleis
Copy link

Kugeleis commented Oct 7, 2023

I have a wifi password with & in it. WIFIManager is not able to connect to it. Error:

Trying to connect to mygreatwifi...
E (275725) wifi:sta is connecting, return error
Traceback (most recent call last):
  File "main.py", line 7, in <module>
  File "wifimgr.py", line 60, in get_connection
  File "wifimgr.py", line 317, in start
  File "wifimgr.py", line 200, in handle_configure
  File "wifimgr.py", line 88, in do_connect
OSError: Wifi Internal Error
MicroPython v1.21.0 on 2023-10-05; Generic ESP32 module with ESP32
@ebolisa
Copy link

ebolisa commented Oct 7, 2023

try this:

# version 1.9 compatibility
    try:
        ssid = match.group(1).decode("utf-8").replace("%3F", "?").replace("%26", "&")
        password = match.group(2).decode("utf-8").replace("%3F", "?").replace("%26", "&")
    except Exception:
        ssid = match.group(1).replace("%3F", "?").replace("%26", "&")
        password = match.group(2).replace("%3F", "?").replace("%26", "&")

@graham768
Copy link

@ebolisa's suggestion has been added as default behavior in the captive portal version of this awesome library

@ebolisa
Copy link

ebolisa commented Jun 15, 2024

@ebolisa's suggestion has been added as default behavior in the captive portal version of this awesome library

Instead of adding all possible combination of characters, why not adding a simple routine to convert them all:

txt = "%3F,%26"

def decode_html(txt):
    dec = json.loads('"' + txt.replace('%', '\\u00') + '"')
    return dec

print(decode_html(txt))  --> ? & and etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants