{"action":"created","issue":{"url":"https://api.github.com/repos/bbcmicrobit/PythonEditor/issues/60","repository_url":"https://api.github.com/repos/bbcmicrobit/PythonEditor","labels_url":"https://api.github.com/repos/bbcmicrobit/PythonEditor/issues/60/labels{/name}","comments_url":"https://api.github.com/repos/bbcmicrobit/PythonEditor/issues/60/comments","events_url":"https://api.github.com/repos/bbcmicrobit/PythonEditor/issues/60/events","html_url":"https://github.com/bbcmicrobit/PythonEditor/issues/60","id":267826708,"number":60,"title":"Support unicode characters longer than a byte","user":{"login":"microbit-carlos","id":29712657,"avatar_url":"https://avatars0.githubusercontent.com/u/29712657?v=4","gravatar_id":"","url":"https://api.github.com/users/microbit-carlos","html_url":"https://github.com/microbit-carlos","followers_url":"https://api.github.com/users/microbit-carlos/followers","following_url":"https://api.github.com/users/microbit-carlos/following{/other_user}","gists_url":"https://api.github.com/users/microbit-carlos/gists{/gist_id}","starred_url":"https://api.github.com/users/microbit-carlos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/microbit-carlos/subscriptions","organizations_url":"https://api.github.com/users/microbit-carlos/orgs","repos_url":"https://api.github.com/users/microbit-carlos/repos","events_url":"https://api.github.com/users/microbit-carlos/events{/privacy}","received_events_url":"https://api.github.com/users/microbit-carlos/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-10-23T21:40:59Z","updated_at":"2017-11-28T16:34:49Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"At the moment the `String.charCodeAt()` method is used to get the user script character codes, and it's return value is stored in a `Uint8Array`.\r\nIf the value returned is larger than a byte, as it would happen with some UTF-8 characters, then some of that information is lost and the wrong character is encoded into the hex file.\r\n\r\n\r\nhttps://github.com/bbcmicrobit/PythonEditor/blob/3d30f7ff2180c2eea0a9d9737edba7c817a413a5/python-main.js#L84-L92\r\n\r\nThis is easy to reproduce, simply create a hex file with a UTF-8 character larger than a byte, download the hex, and load it back into the editor.\r\n\r\n```\r\n# UFT-8 character longer than a byte: Σ\r\n```\r\n\r\nBecomes:\r\n\r\n```\r\n# UFT-8 character longer than a byte: £\r\n```\r\n\r\nAs the chracter `0x03A3` (Σ) has been encoded as `0xA3` (£)"},"comment":{"url":"https://api.github.com/repos/bbcmicrobit/PythonEditor/issues/comments/347582070","html_url":"https://github.com/bbcmicrobit/PythonEditor/issues/60#issuecomment-347582070","issue_url":"https://api.github.com/repos/bbcmicrobit/PythonEditor/issues/60","id":347582070,"user":{"login":"PandaWhoCodes","id":6967017,"avatar_url":"https://avatars0.githubusercontent.com/u/6967017?v=4","gravatar_id":"","url":"https://api.github.com/users/PandaWhoCodes","html_url":"https://github.com/PandaWhoCodes","followers_url":"https://api.github.com/users/PandaWhoCodes/followers","following_url":"https://api.github.com/users/PandaWhoCodes/following{/other_user}","gists_url":"https://api.github.com/users/PandaWhoCodes/gists{/gist_id}","starred_url":"https://api.github.com/users/PandaWhoCodes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PandaWhoCodes/subscriptions","organizations_url":"https://api.github.com/users/PandaWhoCodes/orgs","repos_url":"https://api.github.com/users/PandaWhoCodes/repos","events_url":"https://api.github.com/users/PandaWhoCodes/events{/privacy}","received_events_url":"https://api.github.com/users/PandaWhoCodes/received_events","type":"User","site_admin":false},"created_at":"2017-11-28T16:34:49Z","updated_at":"2017-11-28T16:34:49Z","author_association":"NONE","body":"I would love to see a work around for this without the memory contraints bring increased"}}
{"actor":{"display_login":"PandaWhoCodes"}}