Ash
Ash

Reputation: 31

rake db:seed for i18n data

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?

Upvotes: 2

Views: 1152

Answers (1)

Dan K.K.
Dan K.K.

Reputation: 6094

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.

Upvotes: 5

Related Questions