{"action":"created","issue":{"url":"https://api.github.com/repos/retext-project/retext/issues/211","repository_url":"https://api.github.com/repos/retext-project/retext","labels_url":"https://api.github.com/repos/retext-project/retext/issues/211/labels{/name}","comments_url":"https://api.github.com/repos/retext-project/retext/issues/211/comments","events_url":"https://api.github.com/repos/retext-project/retext/issues/211/events","html_url":"https://github.com/retext-project/retext/pull/211","id":155877651,"number":211,"title":"Auto detect encoding","user":{"login":"starofrainnight","id":9812391,"avatar_url":"https://avatars.githubusercontent.com/u/9812391?v=3","gravatar_id":"","url":"https://api.github.com/users/starofrainnight","html_url":"https://github.com/starofrainnight","followers_url":"https://api.github.com/users/starofrainnight/followers","following_url":"https://api.github.com/users/starofrainnight/following{/other_user}","gists_url":"https://api.github.com/users/starofrainnight/gists{/gist_id}","starred_url":"https://api.github.com/users/starofrainnight/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/starofrainnight/subscriptions","organizations_url":"https://api.github.com/users/starofrainnight/orgs","repos_url":"https://api.github.com/users/starofrainnight/repos","events_url":"https://api.github.com/users/starofrainnight/events{/privacy}","received_events_url":"https://api.github.com/users/starofrainnight/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-05-20T02:58:23Z","updated_at":"2016-05-20T11:04:43Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/retext-project/retext/pulls/211","html_url":"https://github.com/retext-project/retext/pull/211","diff_url":"https://github.com/retext-project/retext/pull/211.diff","patch_url":"https://github.com/retext-project/retext/pull/211.patch"},"body":"I have lots *.rst file in UTF-8 encoding, but while I open it, it display as jumbly characters until I “Set encoding\" to \"UTF-8\" and reload it again. After go around the source codes, I found  retext will load the file with defaultCodec which be initialized to system encoding, but my system encoding is \"GBK\".\r\n\r\nSo if I load a file which content encoding different from defaultCodec, it will be displayed as jumbly characters until I set the encoding correct manually.\r\n\r\nThat's not the end: even I set the encoding correctly, all things seems display correctly, but after I save that file, it will be converted to defaultCodec (which is GBK). So now my UTF-8 encoding file be converted to a GBK encoding file.\r\n\r\nI modified those routines about encoding parts:\r\n\r\n1. Added encoding auto detect behavior before file loading and pass the detected encoding to QTextStream\r\n2. Saved detected encoding to document object \r\n3. Save the file by detected encoding which buffered in the document object \r\n\r\nNow the file encoding load as is and save as it, and seems that we need not set the encoding manually.\r\n\r\nThis only tested on python3.4.3 on Win10 x64 with Chinese language.\r\n"},"comment":{"url":"https://api.github.com/repos/retext-project/retext/issues/comments/220578105","html_url":"https://github.com/retext-project/retext/pull/211#issuecomment-220578105","issue_url":"https://api.github.com/repos/retext-project/retext/issues/211","id":220578105,"user":{"login":"mitya57","id":1381584,"avatar_url":"https://avatars.githubusercontent.com/u/1381584?v=3","gravatar_id":"","url":"https://api.github.com/users/mitya57","html_url":"https://github.com/mitya57","followers_url":"https://api.github.com/users/mitya57/followers","following_url":"https://api.github.com/users/mitya57/following{/other_user}","gists_url":"https://api.github.com/users/mitya57/gists{/gist_id}","starred_url":"https://api.github.com/users/mitya57/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mitya57/subscriptions","organizations_url":"https://api.github.com/users/mitya57/orgs","repos_url":"https://api.github.com/users/mitya57/repos","events_url":"https://api.github.com/users/mitya57/events{/privacy}","received_events_url":"https://api.github.com/users/mitya57/received_events","type":"User","site_admin":false},"created_at":"2016-05-20T11:04:43Z","updated_at":"2016-05-20T11:04:43Z","body":"Thanks for your pull request.\r\n\r\nUnfortunately it makes one of the tests fail (see Travis log), because apparently calling `setProperty` on a text document marks it as modified. Can you please fix it?\r\n\r\nBonus points for:\r\n\r\n- Squashing the commits so that there are not so many of them;\r\n- Removing the trailing whitespace (i.e. as highlighted by `git diff`)."}}
{"actor":{"display_login":"mitya57"}}