Ruby:如何添加“#encoding:UTF-8”自动? [英] Ruby: how to add "# encoding: UTF-8" automatically?
本文介绍了Ruby:如何添加“#encoding:UTF-8”自动?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否有任何宝石会自动将$ code##encoding:UTF-8 添加到每个Ruby文件?整个Ruby on Rails项目(不在单一类)中,是否还有其他方法可以防止无效多字节字符(US-ASCII)
错误?
解决方案
尝试 magic_encoding gem,它可以插入uft-8魔术评论到您应用程序中的所有ruby文件。
现在切换到SublimeText我使用 auto-encoding-for-ruby 插件。
Is there any gem which adds # encoding: UTF-8
to each Ruby file automatically?
Or is there any other way to prevent from the invalid multibyte char (US-ASCII)
error in the entire Ruby on Rails project (not in a single class only)?
解决方案
Try magic_encoding gem, it can insert uft-8 magic comment to all ruby files in your app.
[EDIT] Having switched to SublimeText now I use auto-encoding-for-ruby plugin.
这篇关于Ruby:如何添加“#encoding:UTF-8”自动?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文