encoding detection breaks in locale "C" with UTF-8 source files
Created by: cabo
Since Ruby 2.0, source files are UTF-8 by default.
ruby-lint breaks with that in locale "C":
...lib/ruby/gems/2.2.0/gems/parser-2.2.2.6/lib/parser/source/buffer.rb:157:in `source=': invalid byte sequence in US-ASCII (EncodingError)
from ...lib/ruby/gems/2.2.0/gems/ruby-lint-2.0.4/lib/ruby-lint/parser.rb:40:in `parse'
from ...lib/ruby/gems/2.2.0/gems/ruby-lint-2.0.4/lib/ruby-lint/runner.rb:78:in `parse_file'
The reason is that File.read(file).encoding yields US-ASCII in locale "C". reencode_string takes that for face value instead of properly substituting UTF-8. (The logic in there is somewhat surprising -- clearly any source file without an encoding comment is UTF-8, independent of what File.read says.)