{"action":"created","issue":{"url":"https://api.github.com/repos/octokit/octokit.rb/issues/920","repository_url":"https://api.github.com/repos/octokit/octokit.rb","labels_url":"https://api.github.com/repos/octokit/octokit.rb/issues/920/labels{/name}","comments_url":"https://api.github.com/repos/octokit/octokit.rb/issues/920/comments","events_url":"https://api.github.com/repos/octokit/octokit.rb/issues/920/events","html_url":"https://github.com/octokit/octokit.rb/issues/920","id":251807601,"number":920,"title":"Readme downloaded with wrong encoding","user":{"login":"Bilge","id":470626,"avatar_url":"https://avatars1.githubusercontent.com/u/470626?v=4","gravatar_id":"","url":"https://api.github.com/users/Bilge","html_url":"https://github.com/Bilge","followers_url":"https://api.github.com/users/Bilge/followers","following_url":"https://api.github.com/users/Bilge/following{/other_user}","gists_url":"https://api.github.com/users/Bilge/gists{/gist_id}","starred_url":"https://api.github.com/users/Bilge/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Bilge/subscriptions","organizations_url":"https://api.github.com/users/Bilge/orgs","repos_url":"https://api.github.com/users/Bilge/repos","events_url":"https://api.github.com/users/Bilge/events{/privacy}","received_events_url":"https://api.github.com/users/Bilge/received_events","type":"User","site_admin":false},"labels":[{"id":111853,"url":"https://api.github.com/repos/octokit/octokit.rb/labels/bug","name":"bug","color":"e10c02","default":true}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2017-08-22T00:47:34Z","updated_at":"2018-02-12T21:24:35Z","closed_at":null,"author_association":"NONE","body":"Downloading this readme results in a string with the wrong encoding (should be `UTF-8`).\r\n\r\n```ruby\r\nclient.readme('ScriptFUSION/Porter', accept: 'application/vnd.github.raw')\r\n```\r\n\r\n>encoding = ASCII-8BIT\r\n\r\nThis problem manifests itself when trying to parse it with a markdown processor such as Kramdown.\r\n\r\n```ruby\r\nKramdown::Document.new(\r\n  client.readme('ScriptFUSION/Porter', accept: 'application/vnd.github.raw')\r\n)\r\n```\r\n\r\n>Error:  \"\\xE2\" from ASCII-8BIT to UTF-8\r\n"},"comment":{"url":"https://api.github.com/repos/octokit/octokit.rb/issues/comments/365066946","html_url":"https://github.com/octokit/octokit.rb/issues/920#issuecomment-365066946","issue_url":"https://api.github.com/repos/octokit/octokit.rb/issues/920","id":365066946,"user":{"login":"hahmed","id":658005,"avatar_url":"https://avatars2.githubusercontent.com/u/658005?v=4","gravatar_id":"","url":"https://api.github.com/users/hahmed","html_url":"https://github.com/hahmed","followers_url":"https://api.github.com/users/hahmed/followers","following_url":"https://api.github.com/users/hahmed/following{/other_user}","gists_url":"https://api.github.com/users/hahmed/gists{/gist_id}","starred_url":"https://api.github.com/users/hahmed/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hahmed/subscriptions","organizations_url":"https://api.github.com/users/hahmed/orgs","repos_url":"https://api.github.com/users/hahmed/repos","events_url":"https://api.github.com/users/hahmed/events{/privacy}","received_events_url":"https://api.github.com/users/hahmed/received_events","type":"User","site_admin":false},"created_at":"2018-02-12T21:24:35Z","updated_at":"2018-02-12T21:24:35Z","author_association":"NONE","body":"@kytrinyx can you point me along the right direction in fixing this?\r\n\r\nLooks like all we need to do is check if the response has base64 inside the encoding then encode content as base64.\r\n\r\n```\r\ndef readme(repo, options={})\r\n  response = get \"#{Repository.path repo}/readme\", options\r\n  if response[:encoding] == \"base64\"\r\n    response[:content] = Base64.strict_encode64(response[:content])\r\n   end\r\n  response\r\nend\r\n```\r\n\r\nhttps://github.com/hahmed/octokit.rb/commit/cfb7f5413be4da5278b3f2c6a9ffae393e4161d3#diff-c5bbd24771f20209a3fa4e3766ba01afL19\r\n"}}
{"actor":{"display_login":"hahmed"}}