0

I have an Octopress blog that I host on Heroku using jgarber's custom buildpack. I had things working fairly well as long as I stuck with rdiscount, but I recently decided to switch to kramdown for the MultiMarkdown support. That's when things got weird.

This works fine on my local box (OS X), but when I push to Heroku, I get the following error:

Liquid Exception: incompatible character encodings: UTF-8 and ASCII-8BIT in atom.xml

So far as I can tell, I'm UTF-8 through and through, but I'll readily admit that Ruby isn't my normal stack, so maybe I'm just missing something. I'm on kramdown v0.14.2. When I use foreman run rake clean generate, everything works, as does bundle exec rake clean generate. However, when I push to Heroku (or run heroku run rake clean generate), I get the error above.

I thought the issue might be something to do with the default encodings, so I performed the following experiment:

$ irb
1.9.3-p327 :001 > ENV["LANG"]
=> "en_US.UTF-8"
1.9.3-p327 :002 > Encoding.default_external
=> #<Encoding:UTF-8>

and

$ heroku run irb
Running `irb` attached to terminal... up, run.6846
irb(main):001:0> ENV["LANG"]
=> "en_US.UTF-8"
irb(main):002:0> Encoding.default_external
=> #<Encoding:UTF-8>

At this point, I'm all out of ideas.

Hank Gay
  • 70,339
  • 36
  • 160
  • 222

2 Answers2

0

Have you tried setting the LC_CTYPE env var too? Try LC_CTYPE=en_US.UTF-8.

or9ob
  • 2,313
  • 4
  • 25
  • 45
  • Sadly, that's been part of my `.profile` for years (I had to fix an issue with `svn` back in the day, and it's just hung around). – Hank Gay Jul 22 '13 at 12:55
0

I had a similar issue. My initial setup and deploy to GitHub worked fine. When I just edited the _config.yml and insert some Turkish characters like ş, I got a similar error. Adding system variables like LANG and LC_ALL did not help.

Then I just opened the file with notepad++, changed encoding to UTF-8 without BOM and the issue is solved. This also works for the post files (the ones with .markdown extensions in source/_posts folder)

So just change the file's encoding UTF-8 without BOM before inserting any non-ascii characters. There is no need for the environment variables.

hrzafer
  • 1,123
  • 1
  • 15
  • 35