{"action":"created","issue":{"url":"https://api.github.com/repos/ultrabug/py3status/issues/1575","repository_url":"https://api.github.com/repos/ultrabug/py3status","labels_url":"https://api.github.com/repos/ultrabug/py3status/issues/1575/labels{/name}","comments_url":"https://api.github.com/repos/ultrabug/py3status/issues/1575/comments","events_url":"https://api.github.com/repos/ultrabug/py3status/issues/1575/events","html_url":"https://github.com/ultrabug/py3status/pull/1575","id":380168537,"node_id":"MDExOlB1bGxSZXF1ZXN0MjMwNDMwOTY0","number":1575,"title":"Fix utf8 encoding on py2","user":{"login":"apiraino","id":6098822,"node_id":"MDQ6VXNlcjYwOTg4MjI=","avatar_url":"https://avatars2.githubusercontent.com/u/6098822?v=4","gravatar_id":"","url":"https://api.github.com/users/apiraino","html_url":"https://github.com/apiraino","followers_url":"https://api.github.com/users/apiraino/followers","following_url":"https://api.github.com/users/apiraino/following{/other_user}","gists_url":"https://api.github.com/users/apiraino/gists{/gist_id}","starred_url":"https://api.github.com/users/apiraino/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apiraino/subscriptions","organizations_url":"https://api.github.com/users/apiraino/orgs","repos_url":"https://api.github.com/users/apiraino/repos","events_url":"https://api.github.com/users/apiraino/events{/privacy}","received_events_url":"https://api.github.com/users/apiraino/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":7,"created_at":"2018-11-13T10:57:07Z","updated_at":"2018-12-02T16:09:12Z","closed_at":null,"author_association":"NONE","pull_request":{"url":"https://api.github.com/repos/ultrabug/py3status/pulls/1575","html_url":"https://github.com/ultrabug/py3status/pull/1575","diff_url":"https://github.com/ultrabug/py3status/pull/1575.diff","patch_url":"https://github.com/ultrabug/py3status/pull/1575.patch"},"body":"While working on my plugin, I noticed that logging utf-8 strings raises a `UnicodeEncodeError` at [line 485](https://github.com/apiraino/py3status/blob/0b3832e1ad131b987bfe36e5c5c3abe3fdb289e8/py3status/py3.py#L485).\r\n\r\nI think the issue can be fixed by using in the module:\r\n```\r\ns = \"Amthrÿa - Anesthesia Survival\"\r\nself.py3.log(s.decode('utf-8'))\r\n```\r\nand applying this patch to `py3.py`, which removes the need to cast string to utf-8 with `u'hey hey'`.\r\n\r\nUnfortunately I couldn't easily find a way to write a unit-test for this patch (any help on that would be great!).\r\n\r\nOpinions?\r\n\r\nThanks for reviewing!"},"comment":{"url":"https://api.github.com/repos/ultrabug/py3status/issues/comments/443519047","html_url":"https://github.com/ultrabug/py3status/pull/1575#issuecomment-443519047","issue_url":"https://api.github.com/repos/ultrabug/py3status/issues/1575","id":443519047,"node_id":"MDEyOklzc3VlQ29tbWVudDQ0MzUxOTA0Nw==","user":{"login":"lasers","id":852504,"node_id":"MDQ6VXNlcjg1MjUwNA==","avatar_url":"https://avatars2.githubusercontent.com/u/852504?v=4","gravatar_id":"","url":"https://api.github.com/users/lasers","html_url":"https://github.com/lasers","followers_url":"https://api.github.com/users/lasers/followers","following_url":"https://api.github.com/users/lasers/following{/other_user}","gists_url":"https://api.github.com/users/lasers/gists{/gist_id}","starred_url":"https://api.github.com/users/lasers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lasers/subscriptions","organizations_url":"https://api.github.com/users/lasers/orgs","repos_url":"https://api.github.com/users/lasers/repos","events_url":"https://api.github.com/users/lasers/events{/privacy}","received_events_url":"https://api.github.com/users/lasers/received_events","type":"User","site_admin":false},"created_at":"2018-12-02T16:09:12Z","updated_at":"2018-12-02T16:09:12Z","author_association":"COLLABORATOR","body":"Try this:\r\n```diff\r\ndiff --git a/py3status/modules/mpris.py b/py3status/modules/mpris.py\r\nindex e8429a4..609a576 100644\r\n--- a/py3status/modules/mpris.py\r\n+++ b/py3status/modules/mpris.py\r\n@@ -596,7 +596,7 @@ class Py3status:\r\n             _title = self._data.get('title', None)\r\n             if _title is not None:\r\n                 if self.debug:\r\n-                    self.py3.log(u'[{}] title: \"{}\"'.format(self.audio_perc, _title))\r\n+                    self.py3.log('[{}] title: \"{}\"'.format(self.audio_perc, _title))\r\n                 self._maybe_save_audio()\r\n                 _curr_vol, _ = self._get_volume()\r\n                 if _title == '' or any(k in _title.lower() for k in self.state_quiet_keywords):\r\n\r\n```"}}
{"actor":{"display_login":"lasers"}}