wifi-presence
wifi-presence copied to clipboard
SSID with mixed UTF-8 and ASCII characters cannot be handled correctly
Hi Adam,
Thanks for this great integration!
However, my WiFi SSID begins with UTF-8 character and then ASCII one, like ω=2πf
.
In this case, status
from hostapd_cli
gives something below, which mixes \x
and normal ASCII chars.
ssid[0]=\xcf\x89=2\xcf\x80f
https://github.com/awilliams/wifi-presence/blob/b2b64ea8bce28ef5047b66c9929817240f65bc36/internal/hostapd/status.go#L58-L67
The code above just replace \x
and then decode hex, which still contains non-hex chars, resulting Error: encoding/hex: invalid byte
on my device. I'm not familiar with golang though, but maybe we could use strconv.Unquote
instead? (Ref)
Thanks
Thank you for the detailed report @zhangjingye03, and sorry you are experiencing that issue.
I believe you've identified the section of code responsible for this issue. I'll take a closer look in the coming days and hopefully will have a fix soon.
@zhangjingye03 I've added a fix (#8) for your issue. Please, if you can, try out v0.2.0
and let me know if it fixes your issue. Thanks
Closing. Please re-open @zhangjingye03 if you experience any related issues.