在utf-8文件中转换ascii文件时出现问题。转换无效

时间:2015-04-12 06:07:25

标签: ruby-on-rails ruby utf-8 character-encoding ascii

我在us-ascii中有很多文件但是应该在utf-8

中进行转换

我用

尝试过
recode UTF-8 [filename]

iconv -f ascii -t utf8 [filename] > [newfilename]

但是当我用file -bs [filename] ...

检查文件后

出了什么问题?以及如何正确转换这些文件? (它们是.rb文件)

我必须转换这些文件,因为我在项目中有us-ascii文件时我的ruby on rails app坏了。

更新

感谢您的提示,但是当我这样做时:

iconv -f ISO-8859-1 -t UTF-8

就像在另一个问题中提到的那样......没有任何影响..同样的结果

text/x-ruby; charset=us-ascii

更新 这是一个错误的例子:

incompatible character encodings: UTF-8 and ASCII-8BIT

Extracted source (around line #65):


62:   <div id="content">
63:     <%= render :partial => "shared/breadcrumb" %>
64: 
65:     <%= yield  %>
66:   </div>
67:   <div id="footer">
68:     <%= link_to t("navigation.home"), { :controller => :pages, :action    => :home } %>

0 个答案:

没有答案