22

I do not know what I changed, but today I can no longer build my site's front page with jekyll successfully. It is now complaining about:

[2012-10-30 14:22:10] regeneration: 1 files changed
Liquid Exception: incompatible character encodings: UTF-8 and ASCII-8BIT in index.html

And I'm at a loss to resolve the issue. I believe it's being introduced via a loop of posts I create on the front page, index.html, where I include an excerpt from the last 'n' posts. I used file(1) against my _posts/ directory, and do have some mixture in there:

_posts/2012-08-10-canned-responses-your-silent-partner.md:    UTF-8 Unicode English text, with very long lines
_posts/2012-08-21-alternate-ssh-for-osx.md:                   UTF-8 Unicode English text, with very long lines
_posts/2012-08-21-appus-interruptus.md:                       ASCII English text
_posts/2012-10-25-emoryfocuslight.md:                         ASCII English text
_posts/2012-10-28-distributed-social-networking-with-tent.md: ASCII English text, with very long lines

I'm not sure if this is my problem, though. I use vim and bbedit to edit these files, and they're stored in Dropbox (I build/stage in my Dropbox folder but publish elsewhere). Most of my writing/editing is done on OS X.

When I search for this error message I get a lot of hits for rails applications or forcing ruby gems to use a specific encoding, I don't know if that is relevant or would even help me. Would love to be aimed in the right direction or be told how to resolve this situation. It's a sad state of affairs!

Zombo
  • 1
  • 62
  • 391
  • 407
incumbent
  • 355
  • 2
  • 7
  • I encounter this regularly and would like to see an answer making some semblance of sense. – zetavolt Oct 30 '12 at 19:38
  • 1
    As of 2019 I still get this error. None of `enocding: utf-8` or `chcp 65001` works if I use `--source DIR` option. – Evgeny Mar 10 '19 at 06:56

4 Answers4

22

A fix is to use the configuration

Jekyll Configuration

Example

encoding: utf-8

No mention of UTF fix

Zombo
  • 1
  • 62
  • 391
  • 407
3

Additionally, you might need to change the code page of the console window to UTF-8 in case you get a “Liquid Exception: Incompatible character encoding” error during the site generation process. It can be done with the following command:

chcp 65001

(From the jekyll "Installation for Windows page": http://jekyllrb.com/docs/windows/)

MarkusAtCvlabDotDe
  • 1,032
  • 5
  • 12
  • This did temporarily (for the terminal session) fix the issue for me. But none of the solutions mentioned here fixed it permanently. In my case, after a lot of trial and error, updating ruby (from ruby 2.6 to ruby 3.1) solved the issue permanently and after the update, there is no longer the need to apply the code page change for the terminal. – sceee Sep 01 '22 at 12:13
1

I have been struggling with this same issue lately and finally found out the root cause.

I went through all post files and noticed that the header matter in some old posts contained following:

title: !binary | {mime encoded string}

Propably the Wordpress migration script, which I had used, encoded latin1 strings as !binary in YAML and this caused "incompatible character encodings" error in my case.

I replaced those with correct UTF-8 strings and all went smoothly after that.

iiska
  • 359
  • 2
  • 6
0

Sound daft but re install Jekyll. Then try and re compile your site.

Had a quick google search, bear in mind these are not for Jekyll but ruby so similar.

ruby 1.9 + sinatra incompatible character encodings: ASCII-8BIT and UTF-8

http://www.ruby-forum.com/topic/206925

What have you set the markdown to in your _config?

Community
  • 1
  • 1
joshuahornby10
  • 4,222
  • 8
  • 36
  • 52