rake db:seed fails with multibyte characters in
Rails 3.0.0.
Example seeds.rb file:
countries = Country.create([
{:name => 'Åland Islands', :iso_code => 'AX'},
{:name => 'Côte D\'Ivoire', :iso_code => 'CI'}])
This fails on both the Å and ô characters with the
following error:
claymac:emr clay$ rake db:seed --trace
(in /Users/clay/rails/emr)
Invoke db:seed (first_time)
Invoke db:abort_if_pending_migrations (first_time)
Invoke environment (first_time)
Execute environment
Execute db:abort_if_pending_migrations
Execute db:seed
rake aborted!
/Users/clay/rails/emr/db/seeds.rb:2: invalid multibyte char (US-ASCII)
/Users/clay/rails/emr/db/seeds.rb:2: invalid multibyte char (US-ASCII)
/Users/clay/rails/emr/db/seeds.rb:2: syntax error, unexpected $end, expecting '}'
... {:name => 'Åland Islands', :iso_code => '...
... ^
/Users/clay/.rvm/gems/ruby-1.9.2-p0@up_to_date/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:235:in `load'
/Users/clay/.rvm/gems/ruby-1.9.2-p0@up_to_date/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:235:in `block in load'
/Users/clay/.rvm/gems/ruby-1.9.2-p0@up_to_date/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:225:in `block in load_dependency'
/Users/clay/.rvm/gems/ruby-1.9.2-p0@up_to_date/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:591:in `new_constants_in'
/Users/clay/.rvm/gems/ruby-1.9.2-p0@up_to_date/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:225:in `load_dependency'
/Users/clay/.rvm/gems/ruby-1.9.2-p0@up_to_date/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:235:in `load'
/Users/clay/.rvm/gems/ruby-1.9.2-p0@up_to_date/gems/activerecord-3.0.0/lib/active_record/railties/databases.rake:281:in `block (2 levels) in <top (required)>'
/Users/clay/.rvm/gems/ruby-1.9.2-p0@global/gems/rake-0.8.7/lib/rake.rb:636:in `call'
...
FYI, I used shift-option-A on a US keyboard to create the
Å.