Problem
Markdown encountered an error when I ran rake generate
.
$ rake generate && rake preview
## Generating Site with Jekyll
write source/stylesheets/screen.css
Configuration file: /home/owner/octopress/_config.yml
Source: source
Destination: public
Generating...
Conversion error: Jekyll::Converters::Markdown encountered an error while conv
erting '_posts/2014-01-31-comparison-of-latexs-quote-and-quotation-environments.
markdown/#excerpt':
"\xC2" from ASCII-8BIT to UTF-8
jekyll 2.5.3 | Error: "\xC2" from ASCII-8BIT to UTF-8
Starting to watch source with Jekyll and Compass. Starting Rack on port 4000
Configuration file: /home/owner/octopress/_config.yml
[2015-03-08 15:49:51] INFO WEBrick 1.3.1
[2015-03-08 15:49:51] INFO ruby 2.1.2 (2014-05-08) [i686-linux]
[2015-03-08 15:49:51] INFO WEBrick::HTTPServer#start: pid=5560 port=4000
>>> Compass is watching for changes. Press Ctrl-C to Stop.
directory public/stylesheets
write public/stylesheets/print.css
Source: source
Destination: public
Generating...
write public/stylesheets/screen.css
Conversion error: Jekyll::Converters::Markdown encountered an error while conv
erting '_posts/2014-04-05-latex-template-for-chinese-essays.markdown/#excerpt':
"\xE6" from ASCII-8BIT to UTF-8
jekyll 2.5.3 | Error: "\xE6" from ASCII-8BIT to UTF-8
Discussion
I feel that this problem is similar to the YAML error which I
encountered last year.1 However, I had already added the
line encoding: UTF-8
to _config.yml
, and when I opened the file
with Vim, I saw, from :se fenc
and :se enc
that the encoding was
UTF-8.
I googled “incompatible character encodings utf-8 and ascii-8bit
octopress” and clicked the first result, which was an article written
in 2013.2 According to the blog post, I opened
:~/.rvm/gems/ruby-2.1.2/gems/jekyll-2.5.3/lib/jekyll/converters/markdown.rb
,
but I couldn’t find line 120 because I’m now using Ruby 2.1.2 and
Jekyll 2.5.3.
Though the steps mentioned in another blog posts found were the same, from the first paragraph of that post, I knew that the cause was the embedded Gists in Octopress posts/pages.3
Resolution
I continued viewing other Google search results, and discovered a single question on two different sites. That question was actually a Stack Overflow question which had two responses.4 The second one seemed to solve my problem.
I googled “vim remove bom”, and found another web page.5
Later, I realised that I could find the information using :h bom
. I
typed :se nobomb
in the affected files, and Rake could finally
generate the site.
-
See Resolving Jekyll’s YAML Exception in Blog 1 for details. ↩
-
Octopress 上的 utf-8和ASCII-8BIT 冲突的解决方案 in txx’s blog ↩
-
Octopress里插入带中文Gist的问题和解决 @Lenciel ↩
-
Unicode weirdness with octopress, kramdown, and Heroku on Stack Overflow ↩
-
Remove BOM mark from files with VIM by Santiago Lizardo. ↩