Reputation:
I start having an error all of a sudden whenever I run rake db:create
. The error is
rake aborted!
/home/me/.rvm/gems/ruby-1.9.3-p392/gems/rake-10.0.4/lib/rake/trace_output.rb:16:in `block in trace_on': invalid byte sequence in US-ASCII (ArgumentError)
from /home/me/.rvm/gems/ruby-1.9.3-p392/gems/rake-10.0.4/lib/rake/trace_output.rb:14:in `map'
from /home/me/.rvm/gems/ruby-1.9.3-p392/gems/rake-10.0.4/lib/rake/trace_output.rb:14:in `trace_on'
from /home/me/.rvm/gems/ruby-1.9.3-p392/gems/rake-10.0.4/lib/rake/application.rb:328:in `trace'
from /home/me/.rvm/gems/ruby-1.9.3-p392/gems/rake-10.0.4/lib/rake/application.rb:183:in `display_error_message'
from /home/me/.rvm/gems/ruby-1.9.3-p392/gems/rake-10.0.4/lib/rake/application.rb:169:in `rescue in standard_exception_handling'
from /home/me/.rvm/gems/ruby-1.9.3-p392/gems/rake-10.0.4/lib/rake/application.rb:159:in `standard_exception_handling'
from /home/me/.rvm/gems/ruby-1.9.3-p392/gems/rake-10.0.4/lib/rake/application.rb:70:in `run'
from /home/me/.rvm/gems/ruby-1.9.3-p392/gems/rake-10.0.4/bin/rake:33:in `<top (required)>'
from /home/me/.rvm/gems/ruby-1.9.3-p392/bin/rake:23:in `load'
from /home/me/.rvm/gems/ruby-1.9.3-p392/bin/rake:23:in `<main>'
I did
me@ubuntu:~ export LANG="C.UTF-8"
me@ubuntu:~ export LC_ALL="C.UTF-8"
I got
me@ubuntu:~ echo $LANG
en_US
me@ubuntu:~ echo $LC_ALL
en_US.UTF-8
Upvotes: 2
Views: 10432
Reputation: 103
find . -name *.rb | xargs grep -P "[\x80-\xFF]" -l | xargs sed "1i # encoding: utf-8" -i
try this to fix every .rb file
UPD: tested on ubuntu only.
Upvotes: 7
Reputation: 11
If your name contains a non-US ASCII character (mine has a "Ö" in it), you get lost using Bitnami Redmine stack, since they record that name without any changes to the setup.rb file. It causes this exact error notification 'invalid byte sequence in US-ASCII (ArgumentError)'. As soon as I renamed myself in that file to "oe" everything worked fine! (after rake db:migrate)
Upvotes: 0
Reputation: 1022
try adding, as first line of the files touched by this task, the string:
#encoding: utf-8
These files may be all your custom initializers, your database.yml, etc
Upvotes: 11