Rails和HTML-编码错误 [英] Rails and html - encoding error

查看:73
本文介绍了Rails和HTML-编码错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于诸如utf-8之类的任何代码都没有一行. 所以铁轨当然有问题.

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>.

所以我试图将其粘贴到我的html中: # encoding: < meta charset=utf-8 />.

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?

rails的答案是:unknown encoding name - <

The answer from rails is: unknown encoding name - <

感谢回答

推荐答案

检查文件本身是否另存为UTF-8.

check if the file itself is saved as UTF-8.

这是我的问题.

使用"e"作为文本编辑器或Notepad ++(或任何其他(Windows)工具)配置错误的问题.

Using "e" as a texteditor or Notepad++ (or any other (windows) tool ) with wrong configuration may be the problem.

e(我认为Notepad ++)已配置为将文件另存为"Windows DOS OEM(EP 437)".

e (and i think Notepad++) was configured to save the files as "Windows DOS OEM (EP 437)".

我已在设置中将其更改为UTF-8,保存了alle文件(进行了更改),并且可以使用.

I've changed this in the settings to UTF-8, saved alle files (withoth changes) and it works.

这篇关于Rails和HTML-编码错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆