{"action":"opened","issue":{"url":"https://api.github.com/repos/sosreport/sos/issues/722","labels_url":"https://api.github.com/repos/sosreport/sos/issues/722/labels{/name}","comments_url":"https://api.github.com/repos/sosreport/sos/issues/722/comments","events_url":"https://api.github.com/repos/sosreport/sos/issues/722/events","html_url":"https://github.com/sosreport/sos/issues/722","id":126412769,"number":722,"title":"[reporting] deal with UTF-8 characters","user":{"login":"pmoravec","id":4340368,"avatar_url":"https://avatars.githubusercontent.com/u/4340368?v=3","gravatar_id":"","url":"https://api.github.com/users/pmoravec","html_url":"https://github.com/pmoravec","followers_url":"https://api.github.com/users/pmoravec/followers","following_url":"https://api.github.com/users/pmoravec/following{/other_user}","gists_url":"https://api.github.com/users/pmoravec/gists{/gist_id}","starred_url":"https://api.github.com/users/pmoravec/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pmoravec/subscriptions","organizations_url":"https://api.github.com/users/pmoravec/orgs","repos_url":"https://api.github.com/users/pmoravec/repos","events_url":"https://api.github.com/users/pmoravec/events{/privacy}","received_events_url":"https://api.github.com/users/pmoravec/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-01-13T12:57:00Z","updated_at":"2016-01-13T12:57:00Z","closed_at":null,"body":"If future report `sos.txt` / `sos.html` contains an UTF-8 character, sos raises uncaught exception:\r\n\r\n    Traceback (most recent call last):\r\n      File \"./sosreport\", line 25, in <module>\r\n        main(sys.argv[1:])\r\n      File \"/home/pmoravec/sos-trunk/sos-master/sos/sos/sosreport.py\", line 1617, in main\r\n        sos.execute()\r\n      File \"/home/pmoravec/sos-trunk/sos-master/sos/sos/sosreport.py\", line 1592, in execute\r\n        self.plain_report()\r\n      File \"/home/pmoravec/sos-trunk/sos-master/sos/sos/sosreport.py\", line 1342, in plain_report\r\n        fd.write(str(PlainTextReport(report)))\r\n      File \"/home/pmoravec/sos-trunk/sos-master/sos/sos/reporting.py\", line 151, in __str__\r\n        return \"\\n\".join(buf)\r\n    UnicodeDecodeError: 'ascii' codec can't decode byte 0xc5 in position 49: ordinal not in range(128)\r\n\r\nReproducer: have e.g. some networking interface named in UTF-8, like `/etc/sysconfig/network-scripts/ifcfg-Svazek_připojení_1`.\r\n\r\nParticular reproducer:\r\n1. `LANG=cs_CZ.UTF-8 gnome-control-center`\r\n2. Click to \"síť\" / network\r\n3. Add a new bonding interface without any details (bonding = \"Svazek\" in CZ)\r\n4. Run sosreport (often enough to run with o general)\r\n\r\n\r\nHow to fix this:\r\n1) `\"\\n\".join(buf)` needs to pass decoded UTF-8 text\r\n2) `fd.write` needs to replace str(..) by some other function name\r\n3) `fd.write` needs to encode UTF-8"}}