wycats/thor — Issue #191: incompatible character encodings: ASCII-8BIT and UTF-8 Error
Author: wbzyl
Created: 2011-11-02 19:01:52+00:00
State: open

Running:

thor test:example Þórr

on README with the content

Ł -- utf-8 encoded L slash
use rake

yields

You supplied the text: Þórr
gsub README
.rvm/gems/ruby-1.9.2-p290/gems/thor-0.14.6/lib/thor/actions/file_manipulation.rb:227:in `gsub!':
incompatible character encodings: ASCII-8BIT and UTF-8 (Encoding::CompatibilityError)

Responsible for this is error the file *test.thor*:

require 'thor'

class Test < Thor
include Thor::Actions

desc "example TEXT", "an example task that replaces word 'rake' in README with provided TEXT"
def example(text)
puts "You supplied the text: #{text}"
gsub_file 'README', /rake/ do
"No more rake. Use #{text}"
end
end
end

The above means that I can't gsub a chunk of text with the Polish diacritics in a html.erb file, for example.