本文介绍了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 problem with every "e" character with the accent, like "è é "
我试图添加魔法注释 # coding: utf-8
但它不起作用.
I tried to put magic comment # coding: utf-8
but it doesn't work.
有什么想法吗?
推荐答案
不要添加 #coding: UTF-8
尝试添加 # encoding: UTF-8
on文件的第一行.
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)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!