{"action":"created","issue":{"url":"https://api.github.com/repos/selectel/pyte/issues/62","repository_url":"https://api.github.com/repos/selectel/pyte","labels_url":"https://api.github.com/repos/selectel/pyte/issues/62/labels{/name}","comments_url":"https://api.github.com/repos/selectel/pyte/issues/62/comments","events_url":"https://api.github.com/repos/selectel/pyte/issues/62/events","html_url":"https://github.com/selectel/pyte/issues/62","id":190841602,"number":62,"title":"UTF-8 character incorrectly interpreted as OSC","user":{"login":"tspivey","id":709407,"avatar_url":"https://avatars.githubusercontent.com/u/709407?v=3","gravatar_id":"","url":"https://api.github.com/users/tspivey","html_url":"https://github.com/tspivey","followers_url":"https://api.github.com/users/tspivey/followers","following_url":"https://api.github.com/users/tspivey/following{/other_user}","gists_url":"https://api.github.com/users/tspivey/gists{/gist_id}","starred_url":"https://api.github.com/users/tspivey/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tspivey/subscriptions","organizations_url":"https://api.github.com/users/tspivey/orgs","repos_url":"https://api.github.com/users/tspivey/repos","events_url":"https://api.github.com/users/tspivey/events{/privacy}","received_events_url":"https://api.github.com/users/tspivey/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-11-21T21:33:13Z","updated_at":"2017-02-20T23:32:00Z","closed_at":null,"body":"When trying to upgrade my project to use the current git master, I needed to send data as bytes.\r\nThis works, however I can't decode UTF-8 data. For example, the following test script will fail:\r\n```\r\nimport pyte\r\nscreen = pyte.Screen(10, 1)\r\nstream = pyte.Stream(screen)\r\nc = b\"\\xE2\\x80\\x9D\" #u+201d\r\nstream.feed(c)\r\nprint(screen.display)\r\n```\r\nThe first character of the screen should be '”', but is blank.\r\n\r\nIt looks like pyte is interpreting the 9d as OSC, causing problems from there.\r\nAccording to Wikipedia articles on [ANSI escape codes][1] and [C0 and C1 control codes][2], in UTF-8 mode, OSC (also ST, CSI) should be encoded in UTF-8, so in this case 0xc2 0x9d.\r\n\r\n[1]: https://en.wikipedia.org/wiki/ANSI_escape_code#Sequence_elements\r\n[2]: https://en.wikipedia.org/wiki/C0_and_C1_control_codes\r\n"},"comment":{"url":"https://api.github.com/repos/selectel/pyte/issues/comments/281205781","html_url":"https://github.com/selectel/pyte/issues/62#issuecomment-281205781","issue_url":"https://api.github.com/repos/selectel/pyte/issues/62","id":281205781,"user":{"login":"superbobry","id":185856,"avatar_url":"https://avatars.githubusercontent.com/u/185856?v=3","gravatar_id":"","url":"https://api.github.com/users/superbobry","html_url":"https://github.com/superbobry","followers_url":"https://api.github.com/users/superbobry/followers","following_url":"https://api.github.com/users/superbobry/following{/other_user}","gists_url":"https://api.github.com/users/superbobry/gists{/gist_id}","starred_url":"https://api.github.com/users/superbobry/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/superbobry/subscriptions","organizations_url":"https://api.github.com/users/superbobry/orgs","repos_url":"https://api.github.com/users/superbobry/repos","events_url":"https://api.github.com/users/superbobry/events{/privacy}","received_events_url":"https://api.github.com/users/superbobry/received_events","type":"User","site_admin":false},"created_at":"2017-02-20T23:32:00Z","updated_at":"2017-02-20T23:32:00Z","body":"A straightforward way to fix this would be to add more branching to the already complicated `Stream._parser_fsm`, so I was thinking of tacklingthe issue differently: restrict `pyte` to UTF-8 only inputs. What do you think?"}}
{"actor":{"display_login":"superbobry"}}