2012-02-20 95 views
1

我有一个Rails应用程序,我不断收到此错误红宝石魔术编码不工作

/srv/projects/app/controllers/application_controller.rb:174: invalid multibyte char (US-ASCII) /srv/projects/app/controllers/application_controller.rb:174: invalid multibyte char (US-ASCII) /srv/projects/app/controllers/application_controller.rb:174: syntax error, unexpected $end, expecting ')' ...e_title = h("#{project_name} — #{name || translate_locatio... ...^

和修补程序应该是here但是当我添加的行上我的应用程序控制器的顶部,我仍然得到错误。 ..我连重新开始的Apache

这里是我的应用程序控制器

# Filters added to this controller apply to all controllers in the application. 
# Likewise, all the methods added will be available for all controllers. 

# encoding: utf-8 


class ApplicationController < ActionController::Base 
# encoding: utf-8 

回答

2

的编码注释必须在之前别的文件的顶部 - 包括其他评论(除了shebang,如果你有一个)。

1

你的类应该是这样的:

# encoding: utf-8 
# Filters added to this controller apply to all controllers in the application. 
# Likewise, all the methods added will be available for all controllers. 

class ApplicationController < ActionController::Base 

(在顶部魔术评论)