9
votes

i have been working on jekyll on my personal website and for my blogs, i have come across a problem with UTF-8 encoding.

It works perfectly on my local machine but it doesn't work well in production. https://github.com/freedomgw/thehacklife/blob/gh-pages/_posts/2013-12-14-the-power-of-ajax.md

This is what it actually looks like on live.. http://thehacklife.com/posts/the-power-of-ajax/

I am just not entirely sure how to fix this on github pages... since github are the ones hosting the site. Also, I am using sublime and I am saving it in UTF-8 encoding in markdown format.

Any suggestions are appreciated

2
can't help but noticing this isnt a complete html document ... I would start by loading the page as a complete document (or using ajax) into a template this may help reolve the issuebrendosthoughts
using <meta http-equiv='Content-Type' content='text/html; charset=utf-8' /> in the head may help to give the desired resultbrendosthoughts
What is the issue ? The live page looks good to meMadhur Ahuja
@MadhurAhuja if your browser is defaulted to view UTF-8 encoding, then it will look perfectly fine. but my browser isn't defaulted at that... that's why there are some weird UTF-8 encoding errors. my ' looks like ’freedom
@brendanmorrison hmmm....that's not a bad idea.. i'll try that.freedom

2 Answers

15
votes

I had the same issue. My apostrophes were showing up as ’ . The solution is to declare the encoding explicitly with <meta http-equiv='Content-Type' content='text/html; charset=utf-8' />

0
votes

I had the same issue with new posts (auto-converted old ones worked fine, though). The resolution was to add

layout: post

inside the post.markdown file; example:

---
title: 'My title'
layout: post
---

page content

This will automatically add the UTF-8 charset header mentioned in the other answer / comment.