Closed timdiggins closed 2 years ago
If you don't specify an encoding a thor file will be read as ASCII-8BIT, (unlike a Ruby file which will be UTF-8)
If you specify an encoding of UTF-8 explicitly, it will be respected.
This is very surprising. Especially when added to rubocop defaults which will not allow an encoding of UTF-8 in a ruby file. (https://docs.rubocop.org/rubocop/1.25/cops_style.html#styleencoding)
Reproduction: https://github.com/timdiggins/test-thor-encoding
Probably due to using File.binread at https://github.com/rails/thor/blob/main/lib/thor/util.rb#L153 ?
Maybe related to #191.
We're happy to look at PRs, hint hint 😄
@dorner ok - I got the hint 😉
If you don't specify an encoding a thor file will be read as ASCII-8BIT, (unlike a Ruby file which will be UTF-8)
If you specify an encoding of UTF-8 explicitly, it will be respected.
This is very surprising. Especially when added to rubocop defaults which will not allow an encoding of UTF-8 in a ruby file. (https://docs.rubocop.org/rubocop/1.25/cops_style.html#styleencoding)
Reproduction: https://github.com/timdiggins/test-thor-encoding
Probably due to using File.binread at https://github.com/rails/thor/blob/main/lib/thor/util.rb#L153 ?
Maybe related to #191.