I found a similar post here but I can't solve the problem anyway.
我在这里发现了类似的帖子,但无论如何我无法解决问题。
I got this
我懂了
/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...
The problem is into this string
问题出在这个字符串中
:body => "Nel momento in cui ci si chiede il significato ed il valore della vita, si è malati"
I got the problme with every "e" charachter with the accent like "è é "
我得到了每个“e”字符的问题,其中的重音如“èé”
I tried to put magic comment # coding: utf-8
but it doesnt work
我试图把魔术评论#coding:utf-8但它不起作用
Any idea?
任何想法?
5 个解决方案
#1
64
Instead of adding # coding: UTF-8
try to add # encoding: UTF-8
on the first line of the file.
而不是添加#coding:UTF-8尝试在文件的第一行添加#encoding:UTF-8。
It worked for me. I found the information here : http://groups.google.com/group/sinatrarb/browse_thread/thread/f92529bf0cf62015
它对我有用。我在此处找到了相关信息:http://groups.google.com/group/sinatrarb/browse_thread/thread/f92529bf0cf62015
#2
10
Just add the following line as the first line in the file:
只需将以下行添加为文件的第一行:
# -*- coding: utf-8 -*-
and it will work.
它会起作用。
#3
6
Add a magic comment in the script where you use non-ascii chars? It should go on top of the script.
在脚本中添加使用非ascii字符的魔术注释?它应该在脚本之上。
# encoding: utf-8
It worked for me like charm.
它像魅力一样对我有用。
Or if you want to make the project wide, you have an option of magic-encoding gem
或者如果你想让项目变宽,你可以选择魔术编码宝石
#4
1
I changed the line:
我换了一行:
gem 'pdf-writer', :git => 'git://github.com/metaskills/pdf-writer.git'
and that works for me.
这对我有用。
#5
0
Taken from http://devsolvd.com/questions/rails-3-invalid-multibyte-char-us-ascii
取自http://devsolvd.com/questions/rails-3-invalid-multibyte-char-us-ascii
gem 'pdf-writer', :git => 'git://github.com/metaskills/pdf-writer.git'
This was useful for me
这对我很有用
#1
64
Instead of adding # coding: UTF-8
try to add # encoding: UTF-8
on the first line of the file.
而不是添加#coding:UTF-8尝试在文件的第一行添加#encoding:UTF-8。
It worked for me. I found the information here : http://groups.google.com/group/sinatrarb/browse_thread/thread/f92529bf0cf62015
它对我有用。我在此处找到了相关信息:http://groups.google.com/group/sinatrarb/browse_thread/thread/f92529bf0cf62015
#2
10
Just add the following line as the first line in the file:
只需将以下行添加为文件的第一行:
# -*- coding: utf-8 -*-
and it will work.
它会起作用。
#3
6
Add a magic comment in the script where you use non-ascii chars? It should go on top of the script.
在脚本中添加使用非ascii字符的魔术注释?它应该在脚本之上。
# encoding: utf-8
It worked for me like charm.
它像魅力一样对我有用。
Or if you want to make the project wide, you have an option of magic-encoding gem
或者如果你想让项目变宽,你可以选择魔术编码宝石
#4
1
I changed the line:
我换了一行:
gem 'pdf-writer', :git => 'git://github.com/metaskills/pdf-writer.git'
and that works for me.
这对我有用。
#5
0
Taken from http://devsolvd.com/questions/rails-3-invalid-multibyte-char-us-ascii
取自http://devsolvd.com/questions/rails-3-invalid-multibyte-char-us-ascii
gem 'pdf-writer', :git => 'git://github.com/metaskills/pdf-writer.git'
This was useful for me
这对我很有用