在jekyll-bootstrap的index.md中输入中文即会出现"invalid byte sequence in GBK"的错误.
出错代码如下:
C:\Documents and Settings\yhzhtk\blog>jekyll build .
Configuration file: C:/Documents and Settings/yhzhtk/blog/_config.yml
Source: C:/Documents and Settings/yhzhtk/blog
Destination: C:/Documents and Settings/yhzhtk/blog/_site
Generating... Error reading file C:/Documents and Settings/yhzhtk/blog/_posts/2013-5-30-day.html: invalid byte sequ
ence in GBK
[31m Liquid Exception: invalid byte sequence in GBK in 2013-5-30-day.html[0m
C:/Ruby193/lib/ruby/gems/1.9.1/gems/liquid-2.5.0/lib/liquid/template.rb:141:in `split'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/liquid-2.5.0/lib/liquid/template.rb:141:in `tokenize'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/liquid-2.5.0/lib/liquid/template.rb:58:in `parse'
解决方案为:
将E:\Jekyll\Ruby193\lib\ruby\gems\1.9.1\gems\jekyll-0.12.1\lib\jekyll\convertible.rb文件的28行
self.content = File.read(File.join(base, name))
改为
self.content = File.read(File.join(base, name), :encoding => "utf-8")