{"action":"created","issue":{"url":"https://api.github.com/repos/bbatsov/rubocop/issues/2871","repository_url":"https://api.github.com/repos/bbatsov/rubocop","labels_url":"https://api.github.com/repos/bbatsov/rubocop/issues/2871/labels{/name}","comments_url":"https://api.github.com/repos/bbatsov/rubocop/issues/2871/comments","events_url":"https://api.github.com/repos/bbatsov/rubocop/issues/2871/events","html_url":"https://github.com/bbatsov/rubocop/issues/2871","id":135072770,"number":2871,"title":"Encoding error on OS X 10.11.4 Beta (15E33e)","user":{"login":"Freika","id":3738638,"avatar_url":"https://avatars.githubusercontent.com/u/3738638?v=3","gravatar_id":"","url":"https://api.github.com/users/Freika","html_url":"https://github.com/Freika","followers_url":"https://api.github.com/users/Freika/followers","following_url":"https://api.github.com/users/Freika/following{/other_user}","gists_url":"https://api.github.com/users/Freika/gists{/gist_id}","starred_url":"https://api.github.com/users/Freika/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Freika/subscriptions","organizations_url":"https://api.github.com/users/Freika/orgs","repos_url":"https://api.github.com/users/Freika/repos","events_url":"https://api.github.com/users/Freika/events{/privacy}","received_events_url":"https://api.github.com/users/Freika/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/bbatsov/rubocop/labels/bug","name":"bug","color":"fc2929"}],"state":"open","locked":false,"assignee":{"login":"jonas054","id":336720,"avatar_url":"https://avatars.githubusercontent.com/u/336720?v=3","gravatar_id":"","url":"https://api.github.com/users/jonas054","html_url":"https://github.com/jonas054","followers_url":"https://api.github.com/users/jonas054/followers","following_url":"https://api.github.com/users/jonas054/following{/other_user}","gists_url":"https://api.github.com/users/jonas054/gists{/gist_id}","starred_url":"https://api.github.com/users/jonas054/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jonas054/subscriptions","organizations_url":"https://api.github.com/users/jonas054/orgs","repos_url":"https://api.github.com/users/jonas054/repos","events_url":"https://api.github.com/users/jonas054/events{/privacy}","received_events_url":"https://api.github.com/users/jonas054/received_events","type":"User","site_admin":false},"milestone":null,"comments":6,"created_at":"2016-02-20T13:23:14Z","updated_at":"2016-03-05T14:53:49Z","closed_at":null,"body":"```\r\n╰─⠠⠵ rubocop -V\r\n0.37.2 (using Parser 2.3.0.5, running on ruby 2.3.0 x86_64-darwin15)\r\n\r\n╰─⠠⠵ ruby -v\r\nruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-darwin15]\r\n```\r\n\r\nCommand `rubocop --format html -o rubocop.html` returned an error:\r\n\r\n```\r\nincompatible character encodings: UTF-8 and ASCII-8BIT\r\n(erb):233:in `concat'\r\n(erb):233:in `block (2 levels) in binding'\r\n(erb):225:in `each'\r\n(erb):225:in `block in binding'\r\n(erb):219:in `each'\r\n(erb):219:in `binding'\r\n/Users/frey/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/erb.rb:864:in `eval'\r\n/Users/frey/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/erb.rb:864:in `result'\r\n/Users/frey/.rvm/gems/ruby-2.3.0/gems/rubocop-0.37.2/lib/rubocop/formatter/html_formatter.rb:57:in `render_html'\r\n/Users/frey/.rvm/gems/ruby-2.3.0/gems/rubocop-0.37.2/lib/rubocop/formatter/html_formatter.rb:49:in `finished'\r\n/Users/frey/.rvm/gems/ruby-2.3.0/gems/rubocop-0.37.2/lib/rubocop/formatter/formatter_set.rb:30:in `block (3 levels) in <class:FormatterSet>'\r\n/Users/frey/.rvm/gems/ruby-2.3.0/gems/rubocop-0.37.2/lib/rubocop/formatter/formatter_set.rb:30:in `each'\r\n/Users/frey/.rvm/gems/ruby-2.3.0/gems/rubocop-0.37.2/lib/rubocop/formatter/formatter_set.rb:30:in `block (2 levels) in <class:FormatterSet>'\r\n/Users/frey/.rvm/gems/ruby-2.3.0/gems/rubocop-0.37.2/lib/rubocop/runner.rb:68:in `inspect_files'\r\n/Users/frey/.rvm/gems/ruby-2.3.0/gems/rubocop-0.37.2/lib/rubocop/runner.rb:35:in `run'\r\n/Users/frey/.rvm/gems/ruby-2.3.0/gems/rubocop-0.37.2/lib/rubocop/cli.rb:30:in `run'\r\n/Users/frey/.rvm/gems/ruby-2.3.0/gems/rubocop-0.37.2/bin/rubocop:14:in `block in <top (required)>'\r\n/Users/frey/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/benchmark.rb:308:in `realtime'\r\n/Users/frey/.rvm/gems/ruby-2.3.0/gems/rubocop-0.37.2/bin/rubocop:13:in `<top (required)>'\r\n/Users/frey/.rvm/gems/ruby-2.3.0/bin/rubocop:23:in `load'\r\n/Users/frey/.rvm/gems/ruby-2.3.0/bin/rubocop:23:in `<main>'\r\n/Users/frey/.rvm/gems/ruby-2.3.0/bin/ruby_executable_hooks:15:in `eval'\r\n/Users/frey/.rvm/gems/ruby-2.3.0/bin/ruby_executable_hooks:15:in `<main>'\r\n```\r\nI found similar issue about Japanese encoding here: https://github.com/bbatsov/rubocop/issues/1617\r\n\r\nBut my solution was to _delete_ code from gem source:\r\n\r\nlib/rubocop/formatter/html_formatter.rb:55\r\n```\r\n      def render_html\r\n        context = ERBContext.new(files, summary)\r\n\r\n        - template = File.read(TEMPLATE_PATH, encoding: Encoding::UTF_8)\r\n        + template = File.read(TEMPLATE_PATH)\r\n        erb = ERB.new(template, nil, '-')\r\n        html = erb.result(context.binding)\r\n\r\n        output.write html\r\n      end\r\n```\r\n\r\nAfter deleting `, encoding: Encoding::UTF_8` from 55 line command `rubocop --format html -o rubocop.html` created correct html file with scan results."},"comment":{"url":"https://api.github.com/repos/bbatsov/rubocop/issues/comments/192663274","html_url":"https://github.com/bbatsov/rubocop/issues/2871#issuecomment-192663274","issue_url":"https://api.github.com/repos/bbatsov/rubocop/issues/2871","id":192663274,"user":{"login":"jonas054","id":336720,"avatar_url":"https://avatars.githubusercontent.com/u/336720?v=3","gravatar_id":"","url":"https://api.github.com/users/jonas054","html_url":"https://github.com/jonas054","followers_url":"https://api.github.com/users/jonas054/followers","following_url":"https://api.github.com/users/jonas054/following{/other_user}","gists_url":"https://api.github.com/users/jonas054/gists{/gist_id}","starred_url":"https://api.github.com/users/jonas054/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jonas054/subscriptions","organizations_url":"https://api.github.com/users/jonas054/orgs","repos_url":"https://api.github.com/users/jonas054/repos","events_url":"https://api.github.com/users/jonas054/events{/privacy}","received_events_url":"https://api.github.com/users/jonas054/received_events","type":"User","site_admin":false},"created_at":"2016-03-05T14:53:48Z","updated_at":"2016-03-05T14:53:48Z","body":"@Freika @moritzschepp @cthulhu Perhaps you can try out changes in my pull request?"}}