本文介绍了Rails 3无效的多字节字符(US-ASCII)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在此处找到了类似的帖子,但是无论如何我都无法解决问题.
I found a similar post here but I can't solve the problem anyway.
我明白了
/home/fra/siti/Pensiero/db/seeds.rb:32: invalid multibyte char (US-ASCII)
/home/fra/siti/Pensiero/db/seeds.rb:32: invalid multibyte char (US-ASCII)
/home/fra/siti/Pensiero/db/seeds.rb:32: syntax error, unexpected $end, expecting ')'
... ed il valore della vita, si è malati", :user_id => 1, :cat...
问题出在这个字符串中
:body => "Nel momento in cui ci si chiede il significato ed il valore della vita, si è malati"
每个"e"字符的口音都带有èé"之类的问题
I got the problme with every "e" charachter with the accent like "è é "
我试图添加魔术注释# coding: utf-8
,但是它不起作用
I tried to put magic comment # coding: utf-8
but it doesnt work
有什么主意吗?
推荐答案
而不是添加# coding: UTF-8
,请尝试在文件的第一行添加# encoding: UTF-8
.
Instead of adding # coding: UTF-8
try to add # encoding: UTF-8
on the first line of the file.
对我有用.我在这里找到了信息: http://groups.google.com/group/sinatrarb/browse_thread/thread/f92529bf0cf62015
It worked for me. I found the information here : http://groups.google.com/group/sinatrarb/browse_thread/thread/f92529bf0cf62015
这篇关于Rails 3无效的多字节字符(US-ASCII)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!