开发者

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 lang开发者_Python百科uage strings into UTF-8 characters before calling the rake?


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜