{"action":"created","issue":{"url":"https://api.github.com/repos/nickoala/telepot/issues/164","repository_url":"https://api.github.com/repos/nickoala/telepot","labels_url":"https://api.github.com/repos/nickoala/telepot/issues/164/labels{/name}","comments_url":"https://api.github.com/repos/nickoala/telepot/issues/164/comments","events_url":"https://api.github.com/repos/nickoala/telepot/issues/164/events","html_url":"https://github.com/nickoala/telepot/issues/164","id":178553964,"number":164,"title":"Unicode and the telegram token","user":{"login":"nodex0","id":1660910,"avatar_url":"https://avatars.githubusercontent.com/u/1660910?v=3","gravatar_id":"","url":"https://api.github.com/users/nodex0","html_url":"https://github.com/nodex0","followers_url":"https://api.github.com/users/nodex0/followers","following_url":"https://api.github.com/users/nodex0/following{/other_user}","gists_url":"https://api.github.com/users/nodex0/gists{/gist_id}","starred_url":"https://api.github.com/users/nodex0/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nodex0/subscriptions","organizations_url":"https://api.github.com/users/nodex0/orgs","repos_url":"https://api.github.com/users/nodex0/repos","events_url":"https://api.github.com/users/nodex0/events{/privacy}","received_events_url":"https://api.github.com/users/nodex0/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-09-22T08:48:01Z","updated_at":"2016-09-25T07:42:11Z","closed_at":null,"body":"I am not sure if this is exactly an issue but I wanted to point it out, since I saw related problems in old issues and took me some time.\r\n\r\nWhen builiding a new telepot bot, if you imported the token from, lets say, JSON, the bot will be instanced normally, but every call will cause it to break. So, if the token is unicode, the bot will break in every request to the telegram API because it gets concatenated to strings. Using python 2.7. "},"comment":{"url":"https://api.github.com/repos/nickoala/telepot/issues/comments/249407835","html_url":"https://github.com/nickoala/telepot/issues/164#issuecomment-249407835","issue_url":"https://api.github.com/repos/nickoala/telepot/issues/164","id":249407835,"user":{"login":"nodex0","id":1660910,"avatar_url":"https://avatars.githubusercontent.com/u/1660910?v=3","gravatar_id":"","url":"https://api.github.com/users/nodex0","html_url":"https://github.com/nodex0","followers_url":"https://api.github.com/users/nodex0/followers","following_url":"https://api.github.com/users/nodex0/following{/other_user}","gists_url":"https://api.github.com/users/nodex0/gists{/gist_id}","starred_url":"https://api.github.com/users/nodex0/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nodex0/subscriptions","organizations_url":"https://api.github.com/users/nodex0/orgs","repos_url":"https://api.github.com/users/nodex0/repos","events_url":"https://api.github.com/users/nodex0/events{/privacy}","received_events_url":"https://api.github.com/users/nodex0/received_events","type":"User","site_admin":false},"created_at":"2016-09-25T07:42:11Z","updated_at":"2016-09-25T07:42:11Z","body":"This is what I did:\r\n```python\r\n>>> import telepot\r\n>>> bot = telepot.Bot(u'12345678:TOKEN')\r\n>>> bot.sendMessage(10809372, \"¡hello!\")\r\nUnicodeDecodeError: 'ascii' codec can't decode byte 0xad in position 83: ordinal not\r\nin range(128)\r\n>>> bot.sendMessage(10809372, u\"¡hello!\")\r\nUnicodeDecodeError: 'ascii' codec can't decode byte 0xc2 in position 83: ordinal not\r\nin range(128)\r\n```\r\nIf the message has non-ascii characters it doesn't work, and even if the sendMessage string is set to unicode, still not working.\r\nHowever if the token string is a normal byte string, it does work, with unicode and byte strings (however normal bytes strings have to be properly encoded or so).\r\n"}}
{"actor":{"display_login":"nodex0"}}