开发者

rake db:seed for i18n data

开发者 https://www.devze.com 2023-03-01 03:31 出处:网络
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 --

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

精彩评论

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