[Tutor] dbus.Array to string

Marc Tompkins marc.tompkins at gmail.com
Tue Aug 13 18:49:49 CEST 2013


On Tue, Aug 13, 2013 at 8:59 AM, Amit Saha <amitsaha.in at gmail.com> wrote:


> What does it mean (and will it always work?) when I don't specify any
> encoding:
>
> >>> bytearray(ssid).decode()
> u'BigPond679D85'
>

If you don't specify an encoding, then the default encoding is used; as you
point out a bit later, your local default is ascii.

Will it always work?  NO.  If there are any characters in the input stream
(the SSID in this case), .decode will fail (probably with
UnicodeDecodeError, but I can't test it at the moment.)

I don't know the WiFi spec well enough to know whether you're ever going to
run into non-ASCII characters in an SSID; I'm guessing that people in e.g.
Russia name their networks in Cyrillic, but (despite living in a Russian
neighborhood of Los Angeles) I've never seen any SSIDs that weren't pure
ASCII.  Does anybody out there know the rules for this?  Just now I tried
to change the SSID of my cell phone's mobile hotspot to Cyrillic, but the
configuration utility wouldn't even let me change keyboards; I don't know,
though, whether this is a limitation of the spec or just the local
implementation.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20130813/21baf84b/attachment.html>


More information about the Tutor mailing list