0

I've a rails application, with some javascripts (written in UTF-8). One of the javascripts contains non ANSI characters like à. When the javascript is compiled (one javascript is created from many of them), this characters are wrongly written.

For example, ó becomes ó

I know that there must be a problem of encodings, but I don't know how to resolve it. Is somehow to tell rails that my javascripts are UFT-8? I've tried to add <%# encoding: utf-8 %> to the js file, but its not working.

THanks

1 Answer 1

1

I'll borrow @Kodak answer (and emphatize it just a little bit):

try renaming it to js.erb and placing <%# encoding: utf-8 %> at the top

This thread can be found here, with some more information. Hope it helps!

Encoding error in JavaScript asset in Rails

Sign up to request clarification or add additional context in comments.

2 Comments

As posted in my question I've tried to add <%# encoding: utf-8 %> to the js file, but its not working.
But does the file have a .erb extension?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.