2

I am running rake db:seed to populate i18n data in the database but it doesn't recognize the i18n characters. The error that I get is --

rake aborted!

$HOME/db/seeds.rb:9: invalid multibyte char (US-ASCII)

$HOME/db/seeds.rb:9: invalid multibyte char (US-ASCII)

$HOME/db/seeds.rb:9: syntax error, unexpected $end, expecting '}'

Do I need to convert the native language strings into UTF-8 characters before calling the rake?

Ash
  • 31
  • 3
  • 1
    http://stackoverflow.com/questions/3916931/rails-3-invalid-multibyte-char-us-ascii fixed it – Ash Apr 27 '11 at 09:07

1 Answers1

5

Just add the following line as the first line of your seeds.rb the file:

# -*- coding: utf-8 -*-

UPDATE: In ruby 2.0 (and seems above) you don't need to do this anymore, utf-8 is now being the default encoding.

Dan K.K.
  • 5,915
  • 2
  • 28
  • 34