After a month or two of abscence from the blog I wrote up something small this week.
Quite unexpected, when I pushed my post to openshift for publishing, my blog broke.
The styles were stripped, but the blog was still usable, which is nice actually. It only looked like a website from early 1995.
Anyway, the error I got from "rake generate" (which "compiles" the blog to static HTML using Jekyll) was:
Error = jekyll 2.2.0 | Error: "\xC3" on US-ASCII
The funny thing was, it worked fine on my local machine, but not on the openshift gear. It did work fine the previous blog posts two months earlier.
First, cut the crap: I fixed it by setting the LC_ALL environment variable to en_US.UTF-8.
export LC_ALL=en_US.UTF-8
The reason for this is unknown ...
What was the problem?
A simple google on the error always ended me on some chef issues. At first I thought it was unrelated but since both were using Ruby it was plausible.
The solution they came up with was to set a value for LC_ALL explicetly.
This is an environment variable on linux, part of the "locale" settings. It seems to be empty.
This was strange, because the variable was also empty on my local machine, but I tried it anyway:
export LC_ALL=en_US.UTF-8
Just before I run rake generate. And sure enough, that solved the problem.
So I "integrated" that in my openshift action hook, where I also run rake generate (is for another day).
What I first thought was the problem
I made a new blog post, but typed it first on windows in notepad. I thought, when copying it into my blog it took some "illegal characters" (whatever that means) with it.
But removing the new blog post solved nothing, so I got stranded on that one.
What is the root cause?
I have no idea.
When I look up the error in twitter, I get a small amount of tweets, spanning several years of people not understanding what the error is about.
Perhaps related, when I was apt-get upgrade'ing my other linux machine, it complained a lot about its inability to update LC_ALL.
So I don't know what the hell was going on, but I worked around the problem for now ...
Many questions remain:
- Why was the problem not present on my local machine?
- Where was the \xC3 character?
- Why is it solved by just changing LC_ALL?
- Why did the same stuff work two months ago?
- Is it Ruby?
- And why did I bring helium instead of air?
Conclusion
I hate this error because I don't know what or how or why it happened, but since I worked around it I have no time or energy to investigate it deeper. Not even Google and Twitter are helping me out on this one.
I'm writing it here because it's one of those stupid things you know you'll run into again in a year and you'll tell yourself: "I've seen this before, but I don't remember how I solved it. If only I'd written it down somewhere".
If anyone knows what's going on, please drop me a line.
... Now let's see what happens when I push this post out.