Linux环境下如何将utf-8格式文件转变成无bom的utf-8格式文件?


基于Octopress搭建的博客,使用 rake generate 生成博客的时候会报如下的错误:


 ## Generating Site with Jekyll
identical source/stylesheets/screen.css 
Configuration from /srv/octopress/_config.yml
Building site: source -> public
Liquid Exception: incompatible encoding regexp match (ASCII-8BIT regexp with UTF-8 string) in page
/srv/octopress/plugins/category_list_tag.rb:9:in `gsub'
/srv/octopress/plugins/category_list_tag.rb:9:in `block in render'
/srv/octopress/plugins/category_list_tag.rb:6:in `each'
/srv/octopress/plugins/category_list_tag.rb:6:in `render'

参阅了网上的一些说明,是因为utf-8格式格式造成的,所以请问Linux环境下如何将utf-8格式文件转变成无bom的utf-8格式文件?

Linux Ubuntu octopress

karad 10 years, 11 months ago

用 Vim 打开,


 :set nobomb
:wq

或者用 tail 命令:


 tail -c +4 old_file > new_file

不老峰moku answered 10 years, 11 months ago

Your Answer