Device connects to HotSpot with ASCII SSID, but not when given name with foreign UTF-8 letters

504 Views Asked by At

and thanks to this wonderful forum!

I'm developing a device that runs Linux embedded using wpa-supplicant. I must be able to connect to any Wifi network with any SSID - including symbols and foreign characters. I've been learning about UTF-8 encoding and experimenting with all types of names for SSID.

When the HotSpot on my Android is called 123=Mechi_abc, the device connects:

Oct  3 07:17:42.222 **wpa_cli scan_results**  
Selected interface 'wlan0'  
bssid / frequency / signal level / flags / ssid  
b2:22:7a:91:85:e5       2437    -75     [WPA2-PSK-CCMP][WPS][ESS][P2P]  DIRECT-E5-HP OfficeJet Pro 8020  
20:58:69:63:89:48       2462    -80     [WPA2-PSK-CCMP][ESS]  
20:58:69:23:89:48       2462    -79     [ESS]   Leumi_Guest  
20:58:69:a3:89:48       2462    -82     [ESS]   Plazma  
**8a:18:94:1d:e9:0f       2462    -21     [ESS]   123=Mechi_abc**  

Oct  3 07:17:42.333 **wpa_cli set_network** 4 ssid '"**123=Mechi_abc**"'

Oct  3 07:17:42.506 **wpa_cli list_networks**  
Selected interface 'wlan0'  
network id / ssid / bssid / flags  
0       MYEYE_AUTO      any     
1       Plazma  any     
2       Leumi_Guest     any     
4       **123=Mechi_abc**   any

Oct  3 07:17:43.104 **wpa_cli select_network** 4

Oct  3 07:17:43.169 **wpa_cli status**  
Selected interface 'wlan0'  
wpa_state=DISCONNECTED  
ip_address=192.168.72.3  
p2p_device_address=34:e1:d1:a7:19:62  
address=34:e1:d1:a7:19:62  
uuid=9f4c27f1-a49d-5486-8821-465bc569b9ea


Oct  3 07:17:43.184 **wpa_cli list_networks**  
Selected interface 'wlan0'  
network id / ssid / bssid / flags  
0       MYEYE_AUTO      any     [DISABLED]  
1       Plazma  any     [DISABLED]  
2       Leumi_Guest     any     [DISABLED]  
4       123=Mechi_abc   any
   

Oct  3 07:18:07.067 **wpa_cli status**  
Selected interface 'wlan0'  
bssid=8a:18:94:1d:e9:0f  
freq=2462  
ssid=**123=Mechi_abc**  
id=4  
mode=station  
pairwise_cipher=NONE  
group_cipher=NONE  
key_mgmt=NONE  
**wpa_state=COMPLETED**  
ip_address=192.168.72.3  
p2p_device_address=34:e1:d1:a7:19:62  
address=34:e1:d1:a7:19:62  
uuid=9f4c27f1-a49d-5486-8821-465bc569b9ea


Oct  3 07:18:07.100 **wpa_cli list_networks**  
Selected interface 'wlan0'  
network id / ssid / bssid / flags  
0       MYEYE_AUTO      any     [DISABLED]  
1       Plazma  any     [DISABLED]  
2       Leumi_Guest     any     [DISABLED]  
4       **123=Mechi_abc   any     [CURRENT]**

When the name of the Android HotSpot is "123מכיabc" (123 + 3 Hebrew letters + abc) - UTF-8 - 123\xd7\x9e\xd7\x9b\xd7\x99abc (which is viewed correctly with Hebrew letters using an iPhone).

The network is found, selected - but the wpa_state remains SCANNING and doesn't become COMPLETED. After a while (1.5 minutes), the device realizes that it's not really connected and tries to find another network:

Oct  3 07:09:50.819 **wpa_cli list_networks**  
Selected interface 'wlan0'  
network id / ssid / bssid / flags  
0       MYEYE_AUTO      any     [DISABLED]  
1       Plazma  any     [DISABLED]  
2       Leumi_Guest     any     [DISABLED]  
8       **123\\xd7\\x9e\\xd7\\x9b\\xd7\\x99abc**    any  

Oct  3 07:09:50.854 **wpa_cli scan_results**  
Selected interface 'wlan0'  
bssid / frequency / signal level / flags / ssid  
b2:22:7a:91:85:e5       2437    -65     [WPA2-PSK-CCMP][WPS][ESS][P2P]  DIRECT-E5-HP OfficeJet Pro 8020  
5e:dc:7a:5a:88:9b       2462    -33     [ESS]   **123\xd7\x9e\xd7\x9b\xd7\x99abc**  
20:58:69:23:89:48       2462    -79     [ESS]   Leumi_Guest  
20:58:69:a3:89:48       2462    -79     [ESS]   Plazma  

Oct  3 07:09:51.127 **wpa_cli select_network 8**  

Oct  3 07:09:51.277 **wpa_cli list_networks**  
Selected interface 'wlan0'  
network id / ssid / bssid / flags  
0       MYEYE_AUTO      any     [DISABLED]  
1       Plazma  any     [DISABLED]  
2       Leumi_Guest     any     [DISABLED]  
8       **123\\xd7\\x9e\\xd7\\x9b\\xd7\\x99abc**    any     **[CURRENT]**  

Oct  3 07:10:15.381 **wpa_cli status**  
Selected interface 'wlan0'  
wpa_state=SCANNING  
ip_address=192.168.72.3  
p2p_device_address=34:e1:d1:a7:19:62  
address=34:e1:d1:a7:19:62  
uuid=9f4c27f1-a49d-5486-8821-465bc569b9ea  

Is there any reason why this is happening? What does the wpa-supplicant "need" in order to change wpa_state from SCANNING to COMPLETED? PLEASE help with ideas.

Thanks, Mechi

1

There are 1 best solutions below

1
Mechi On

If an SSID has characters/symbols other than ASCII printable characters under 0x7F, the full SSID must be supplied as HEX. In my example above, use

set_network X ssid 313233d79ed79bd799616263

It may not always be displayed with the correct symbols, and only using UTF-8 encoding, but it will be possible to connect to the network.