2012-04-11 169 views
0

我正在嘗試在服務器位於我的公司內部的網站中使用Twitter小部件,因此,在其代理服務器後面。Twitter代理部件代理

我不能直接使用它們提供的代碼,因爲我無法到達源地址。

<script charset="utf-8" src="http://widgets.twimg.com/j/2/widget.js"></script> 

我在想,如果我可以做的JS的本地副本,這樣我就能避免這個問題,但是,當我這樣做,我得到:

ActionView::WrongEncodingError in Home#index 
Your template was not saved as valid UTF-8. Please either specify UTF-8 as the encoding  for your template in your text editor, or mark the template with its encoding by inserting the following as the first line of the template: 

# encoding: <name of correct encoding>. 

但編碼它已設置。

我真的很喜歡這個東西。 請幫忙。

回答

0

你得到的錯誤是因爲ruby需要一個明確的編碼來正確解析一個非拉丁文件。

在具有UTF-8字符的每個ruby文件,你需要在第一線類似的例子:

# encoding: UTF-8 

至於你的問題是主要問題,你可以嘗試,但可能與Twitter通信被阻斷。 您應該與系統管理員聯繫,嘗試訪問您的應用的Twitter。