2012-02-20 147 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 

(在頂部魔術評論)