{"action":"created","issue":{"url":"https://api.github.com/repos/seveas/python-networkmanager/issues/30","repository_url":"https://api.github.com/repos/seveas/python-networkmanager","labels_url":"https://api.github.com/repos/seveas/python-networkmanager/issues/30/labels{/name}","comments_url":"https://api.github.com/repos/seveas/python-networkmanager/issues/30/comments","events_url":"https://api.github.com/repos/seveas/python-networkmanager/issues/30/events","html_url":"https://github.com/seveas/python-networkmanager/issues/30","id":192522233,"number":30,"title":"Crash on non-utf8 SSIDs","user":{"login":"vidstige","id":655605,"avatar_url":"https://avatars.githubusercontent.com/u/655605?v=3","gravatar_id":"","url":"https://api.github.com/users/vidstige","html_url":"https://github.com/vidstige","followers_url":"https://api.github.com/users/vidstige/followers","following_url":"https://api.github.com/users/vidstige/following{/other_user}","gists_url":"https://api.github.com/users/vidstige/gists{/gist_id}","starred_url":"https://api.github.com/users/vidstige/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vidstige/subscriptions","organizations_url":"https://api.github.com/users/vidstige/orgs","repos_url":"https://api.github.com/users/vidstige/repos","events_url":"https://api.github.com/users/vidstige/events{/privacy}","received_events_url":"https://api.github.com/users/vidstige/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-11-30T09:58:38Z","updated_at":"2016-11-30T13:51:15Z","closed_at":null,"body":"I encountered some access points with SSID byte sequences not decodable as utf-8. Here are two examples\r\n\r\n* b'\\xe9\\x87\\x91\\xe8\\xbf\\xaa\\xe9\\xab\\x9899999'\r\n* b'MERCURY_\\xe8\\x80\\x81\\xe7\\x8e\\x8b'\r\n\r\nHere NetworkManager bails out like so\r\n\r\n```\r\n  File \"/usr/local/lib/python3.5/dist-packages/NetworkManager.py\", line 81, in get_func\r\n    return self.postprocess(name, self.unwrap(data))\r\n  File \"/usr/local/lib/python3.5/dist-packages/NetworkManager.py\", line 299, in postprocess\r\n    return fixups.ssid_to_python(val)\r\n  File \"/usr/local/lib/python3.5/dist-packages/NetworkManager.py\", line 425, in ssid_to_python\r\n    return bytes(\"\",'ascii').join(ssid).decode('utf-8')\r\nUnicodeDecodeError: 'utf-8' codec can't decode byte 0xba in position 2: invalid start byte\r\n```\r\n\r\nIt's fairly easy to catch, but harder to get raw bytes to do something more meaningful with. Perhaps there could be another function on the `AccessPoint` class for example, get_raw_ssid` that returns a `bytes` object.\r\n\r\nWhats your thoughts on this @seveas ?"},"comment":{"url":"https://api.github.com/repos/seveas/python-networkmanager/issues/comments/263877913","html_url":"https://github.com/seveas/python-networkmanager/issues/30#issuecomment-263877913","issue_url":"https://api.github.com/repos/seveas/python-networkmanager/issues/30","id":263877913,"user":{"login":"vidstige","id":655605,"avatar_url":"https://avatars.githubusercontent.com/u/655605?v=3","gravatar_id":"","url":"https://api.github.com/users/vidstige","html_url":"https://github.com/vidstige","followers_url":"https://api.github.com/users/vidstige/followers","following_url":"https://api.github.com/users/vidstige/following{/other_user}","gists_url":"https://api.github.com/users/vidstige/gists{/gist_id}","starred_url":"https://api.github.com/users/vidstige/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vidstige/subscriptions","organizations_url":"https://api.github.com/users/vidstige/orgs","repos_url":"https://api.github.com/users/vidstige/repos","events_url":"https://api.github.com/users/vidstige/events{/privacy}","received_events_url":"https://api.github.com/users/vidstige/received_events","type":"User","site_admin":false},"created_at":"2016-11-30T13:51:15Z","updated_at":"2016-11-30T13:51:15Z","body":"haha, I know, what's wrong with people. :-)\r\n\r\nThanks for your input. I think it is fine if this property raises an exception, but I would prefer to have a separate `RawSsid` or something, otherwise you have to check the return type as it might sometimes return bytes and sometimes utf-8 str. But both of your suggestions sounds fine! :+1: If I find the time, I'll make a pull request. For now I'm just catching the exception and using a string \"[non-decodable]\". This, I feel also has an educational effect."}}
{"actor":{"display_login":"vidstige"}}