mercredi 1 février 2017

Rails: error when including javascript

I have some JavaScript on another, non-Rails, site that works for browser side sort of tables. If I reference this in my Rails app from the external site, it works fine:

<script type="text/javascript" src="http://ift.tt/2kWbUK0"></script>

If I put it in the assets/javascripts folder, I get an error:

Encoding::InvalidByteSequenceError in Taxes#index
Showing /home/asa/Rails/home/app/views/layouts/application.html.erb where line #8 raised:
"\xA3" on UTF-8

Can you point me to what this error is, why I am getting it, how do I fix it?

I did find a reference that says name it sort.js.erb and include the line:

<%# encoding: utf-8 %>

But that made no difference.

Alternately, is there a way I can put this JavaScript on the site and use a fixed reference it? I have had no success in doing that.

Aucun commentaire:

Enregistrer un commentaire