Jekyll JSON incorrect character encoding

317 views Asked by At

I'm using simple-jekyll-search to create a search page for my posts in Jekyll.

The JSON file to search is generated by:

[
{% for post in site.posts %}
{
"title"    : "{{ post.title | escape }}",
"category" : "{{ post.category }}",
"tags"     : "{{ post.tags | join: ', ' }}",
"url"      : "{{ site.baseurl }}{{ post.url }}",
"date"     : "{{ post.date | date: '%Y %B %-d' }}",
"content"  : "{{ post.content | strip_html | strip_newlines }}"
} {% unless forloop.last %},{% endunless %}
{% endfor %}
]

The problem is that certain characters are incorrectly encoded in the JSON file (though they appear correctly in the HTML). "You’ll" appears as "You’ll" in the JSON, for example. There's clearly an issue with incompatibility of character encoding, but I'm not sure where to fix it. Since it's only incorrect in the JSON, I'm guessing it's somewhere in this template to generate the JSON, but I can't for the life of me figure out how.

0

There are 0 answers