non ASCII SSIDs in android

最后都变了- 提交于 2020-01-07 06:14:06

问题


Apparently SSIDs can contain UTF-8 chars and also control characters etc. IIUC to contain UTF-8 chars they must specify the SSIDEncoding field. I was under the impression that I can only get ASCII bytes till now.

How should I handle the situation in Android ? Namely, how can I check the SSIDEncoding field from the ScanResult ? Do I need to ? Also what does ScanResult.SSID contain in these cases (including the case an SSID includes non printable characters) ?

Related

  • Why can't I detect a wifi SSID with unicode characters on Android?

回答1:


The short answer is that you can't detect it, but you don't need to.

Android only returns a String in ScanResult and WifiConfiguration (There is no documented encoding field). Since Java Strings can contain accept different encodings, but internally store unicode (How to check the charset of string in Java?) then the original encoding is lost in translation. But if all you need is a String and you are using APIs and storage mechanisms that accept Java String then all of those things should already support encoding that String to whatever format they require and you probably have nothing to worry about.

I can't speak to what Android does under the covers with respect to giving you that String, but the link you provided provides some ideas. If Android does or does not support different encoding types for the SSID, there's nothing you can do about it.



来源:https://stackoverflow.com/questions/20277425/non-ascii-ssids-in-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!