incumbent
incumbent

Reputation: 355

My jekyll site can't build: Liquid Exception: incompatible character encodings

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!

Upvotes: 22

Views: 5170

Answers (4)

MarkusAtCvlabDotDe
MarkusAtCvlabDotDe

Reputation: 1042

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/)

Upvotes: 3

Zombo
Zombo

Reputation: 1

A fix is to use the configuration

Jekyll Configuration

Example

encoding: utf-8

No mention of UTF fix

Upvotes: 22

iiska
iiska

Reputation: 359

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.

Upvotes: 1

joshuahornby10
joshuahornby10

Reputation: 4302

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?

Upvotes: 0

Related Questions