我正在尝试在服务器位于我公司内部的网站中使用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 :(得分:0)
你得到的错误是因为ruby需要一个显式编码才能正确解析非latin-1文件。
在每个包含utf-8字符的ruby文件中,您需要第一行,例如:
# encoding: UTF-8
至于您问题中的主要问题,您可以尝试,但可能会阻止与Twitter的通信。 您应该与系统管理员联系,尝试访问您应用的Twitter。