在Android的非ASCII的SSID [英] non ASCII SSIDs in android

查看:673
本文介绍了在Android的非ASCII的SSID的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

显然中的SSID可以包含UTF-8字符也控制字符等IIUC包含UTF-8字符他们必须指定SSIDEncoding领域。我是IM pression,我只能得到ASCII字节至今之下。

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.

我应该如何处理的Andr​​oid的情况呢?也就是说,我怎么能在ScanResult检查SSIDEncoding领域?我是否需要?另外是什么 ScanResult.SSID 包含在这些情况下(包括SSID包括非打印字符的情况下的)?

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) ?

相关

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

推荐答案

简短的回答是,你不能检测到它,但你并不需要。

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

Android的只返回ScanResult和WifiConfiguration一个字符串(没有记录编码字段)。由于Java字符串可以包含接受不同的编码,但内部存储UNI code(的如何检查字符串的字符集在Java中?),那么原来的编码在翻译中丢失。但是,如果你需要的是一个字符串,并且您使用API​​和接受Java的String存储机制,那么所有的这些事情应该已经支持字符串到他们所需要的任何格式的编码,你可能没有什么可担心的。

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.

我不能什么的Andr​​oid在幕后做就给出这样的字符串说话,但你所提供的链接提供了一些思路。如果Android提供或用于SSID不支持不同编码类型,还有什么可以做的。

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.

这篇关于在Android的非ASCII的SSID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆