2013-02-22 64 views
0

有些時候,當使用輸入沒有路由的鏈接,我提出一個不錯的消息,如:如何修復UTF-8中的無效字節序列?

*對不起,此鏈接{} @not_found_path沒有從我們的舊網站遷移,或者你已經正確輸入。 *

我怎樣才能解決@not_found_path值,使得我沒有得到錯誤:

模板invalid byte sequence in UTF-8?我有紅寶石1.9.3安裝軌3.2.11

任何想法?

def render_404(exception) 
     @not_found_path = exception.message 
     respond_to do |format| 
     format.html { render template: 'errors/not_found', layout: 'layouts/application', status: 404 } 
     format.all { render nothing: true, status: 404 } 
     end 
    end 
+0

您需要保存你的意見,有效的UTF8。 – SLaks 2013-02-22 20:01:14

+0

但我該怎麼辦? – simo 2013-02-23 05:51:36

+0

通過配置您的文本編輯器。 – SLaks 2013-02-24 01:36:03

回答

0

我已經解決了它的觀點是這樣的:

The link #{content_tag(:span, @not_found_path.force_encoding("ISO-8859-1").encode("utf-8"), :class => 'text-error')} is not found, We are sorry for that, as we have migrated our website, we could not restore all the links. 

我希望這將幫助一些一個

相關問題