diff --git a/lib/jekyll-gist/gist_tag.rb b/lib/jekyll-gist/gist_tag.rb
index b6ee18f..3e9b844 100644
--- a/lib/jekyll-gist/gist_tag.rb
+++ b/lib/jekyll-gist/gist_tag.rb
@@ -9,6 +9,7 @@ module Gist
class GistTag < Liquid::Tag
def render(context)
+ @encoding = context.registers[:site].config['encoding'] || 'utf-8'
if tag_contents = determine_arguments(@markup.strip)
gist_id, filename = tag_contents[0], tag_contents[1]
if context.has_key?(gist_id)
@@ -51,6 +52,7 @@ def gist_script_tag(gist_id, filename = nil)
def gist_noscript_tag(gist_id, filename = nil)
code = fetch_raw_code(gist_id, filename)
if !code.nil?
+ code = code.force_encoding(@encoding)
""
else
Jekyll.logger.warn "Warning:", "The