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

10,300

Solution 1

The SSID field in a 802.11 packet has 32 bytes. I believe that Android devices (as well as other devices) choose to interpret each byte as an individual character (this is probably also part of the 802.11 standard). This is why SSIDs are limited to 32 characters.

Now since we only use a single byte to represent each character, we only have 8 bits to use. Using a two's complement system (probably used) the highest number we can represent is 127 (2 ^ (8-1)).

Standard ASCII characters can be represented with a single byte, each corresponding to a decimal value between 0 and 127. Unicode characters on the other hand, require anywhere from 1 to 4 bytes to represent. Thus if the 802.11 specification was modified to include 4 byte Unicode characters in the SSID field, you'd only be able to use a maximum of 8 characters in your SSID. I guess somewhere along the line someone decided to favour 32 characters from a smaller pool, over 8 characters from a larger pool.

You could possibly get around this by writing a custom driver on the device to interpret the 32 byte SSID field as Unicode characters, but I wouldn't recommend it.

As mentioned in the comments, Unicode characters can be encoded as UTF-8 so my earlier answer is not valid.

Solution 2

I've wrote an app "WiFi Connection Manager" to fix this problem. However, I don't understand any Armenian, so that the result may not be displayed correctly. You can still connect to the Access Point even if the names are displayed incorrectly with my app.

You may find it in the Android Market.

Or you can download it here.

Share:
10,300
Ben
Author by

Ben

Updated on June 14, 2022

Comments

  • Ben
    Ben almost 2 years

    I have a wifi AP with an SSID that's a string of unicode characters (ex: "ԱԲԳԴԵԶԷԸԹԺԻԼ") that I want my Android device to connect to. When my device (Nexus One) detects the hotspot, the SSID looks like this: "܍܍܍܍܍܍܍܍" and does not recognize it. Any idea how to fix this?

    • zapl
      zapl about 12 years
      use a-z for your SSID, unicode can cause all sorts of problems.
    • Rolf
      Rolf over 8 years
      @zapl it's not unicode that causes "all sorts of problems" but the lack of support for it on some devices - because it's simpler and cheaper for the makers not to support it.
    • zapl
      zapl over 8 years
      @Rolf still means that Unicode is a bad idea in ssids
  • Ben
    Ben about 12 years
    Awesome! How did you overcome the special character issue? I'm trying to use unicode characters as a representation for an underlying bit sequence, so I have to be able to incorporate this into my own app. (It's for my master's project – I promise I'm not making a competitor to your app, haha.)
  • roamingsoft
    roamingsoft about 12 years
    You need to deal directly with the wifi service to get the raw scan result. The results are different from devices and drivers. If you only need it to work on one device, it wouldn't take much time.
  • Admin
    Admin over 11 years
    Note that it is possible to store Unicode characters in an array of bytes if the Unicode is encoded in UTF-8. So the answer above is not really valid.
  • Mr_and_Mrs_D
    Mr_and_Mrs_D over 10 years
    "you'd only be able to use a maximum of 8 characters in your SSID" - nope up to 32. Remember 1-4 bytes are used - and for oriental languages usually just 2
  • Mr_and_Mrs_D
    Mr_and_Mrs_D over 10 years
  • Mr_and_Mrs_D
    Mr_and_Mrs_D about 10 years
    I am asking exactly how and offering a bounty for it here: stackoverflow.com/questions/20277425/non-ascii-ssids-in-andr‌​oid
  • Damon
    Damon about 4 years
    Wait, do I understand this correctly? It's actually bytes? So, a SSID with byte values that are non-printable (line breaks, tabs, and NUL bytes included) is a valid SSID per the specification? I'm so tempted to do that...