rake tasks fail with invalid byte sequence in US-ASCII rake tasks fail with invalid byte sequence in US-ASCII ruby ruby

rake tasks fail with invalid byte sequence in US-ASCII


Add

#encoding: utf-8 

to the first line of your Rakefile (or whatever file has the strange characters in)


Track down the rake file(s) at fault by deleting one at a time.

ie the files under lib/tasks/delete_me.rake

Then re-rake or restart which ever was giving you the issue. Once the issue is gonedo a git diff to see which file was the culprit and with your favorite editor change the encoding of the file.

ie.,

vim lib/tasks/delete_me.rake:set fileencoding=utf-8:wq

Then re-rake and you should be back in service.


First run

$ sudo gem install magic_encoding

Then go into the folder and run

$ magic_encoding

Ready!