Reputation: 11
in my template (index.html.erb) is no line for any code like utf-8 or anything. so rails of course has a problem with that.
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>.
so i tried to paste this into my html:
# encoding: < meta charset=utf-8 />.
did i write something wrong? or can i take any other code?
The answer from rails is: unknown encoding name - <
thanks for answering
Upvotes: 1
Views: 8248
Reputation: 2682
That solved for me. It was my file that was not being saved as utf-8 after all.
https://superuser.com/questions/581553/sublime-text-2-encoding-utf-8
Upvotes: 0
Reputation: 1570
in your application.rb file paste this line
config.encoding = "utf-8"
or in your application.html.erb file paste the following line
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
Upvotes: 4
Reputation: 1688
Using Rubymine4, accidentally right clicked and didn't see what I had pressed... BANG! code = gone! Plus 1 error! I had reencoded the page to some crazy encoding. Just right click in page and -> save '[Your crazy Encoding here]' file in another encoding.
Rubymine, too easy! ;)
Upvotes: 0
Reputation: 851
check if the file itself is saved as UTF-8.
This was my problem.
Using "e" as a texteditor or Notepad++ (or any other (windows) tool ) with wrong configuration may be the problem.
e (and i think Notepad++) was configured to save the files as "Windows DOS OEM (EP 437)".
I've changed this in the settings to UTF-8, saved alle files (withoth changes) and it works.
Upvotes: 4
Reputation: 9740
The meta charset is for HTML. You need to specify the charset for ruby, you can do it by using a comment like this:
# encoding: utf-8
Upvotes: 1