Open
Description
I wonder what was the intention of #528? I am asking since this fails:
$ LC_ALL=cs_CZ.ISO-8859-2 rspec ./spec/actions/inject_into_file_spec.rb:107
Run options: include {:locations=>{"./spec/actions/inject_into_file_spec.rb"=>[107]}}
F
Failures:
1) Thor::Actions::InjectIntoFile#invoke! can insert chinese
Failure/Error: if force || !content.include?(replacement)
Encoding::CompatibilityError:
incompatible character encodings: ISO-8859-2 and UTF-8
# ./lib/thor/actions/inject_into_file.rb:102:in `include?'
# ./lib/thor/actions/inject_into_file.rb:102:in `replace!'
# ./lib/thor/actions/inject_into_file.rb:57:in `invoke!'
# ./lib/thor/actions.rb:94:in `action'
# ./lib/thor/actions/inject_into_file.rb:27:in `insert_into_file'
# ./spec/actions/inject_into_file_spec.rb:20:in `block in invoke!'
# ./spec/helper.rb:55:in `capture'
# ./spec/actions/inject_into_file_spec.rb:20:in `invoke!'
# ./spec/actions/inject_into_file_spec.rb:108:in `block (3 levels) in <top (required)>'
Finished in 0.01246 seconds (files took 0.31693 seconds to load)
1 example, 1 failure
Failed examples:
rspec ./spec/actions/inject_into_file_spec.rb:107 # Thor::Actions::InjectIntoFile#invoke! can insert chinese
Previously, if nothing else, the encoding of File.binread
was given. Now it gets a file of unknown encoding, tries to apply system encoding and do some stuff above it. If the encoding is assumed, then it should be probably specified somewhere or there should be done a conversion.
Metadata
Metadata
Assignees
Labels
No labels