From db22c6c5dabac89b66aab8dd0710636d9be75a67 Mon Sep 17 00:00:00 2001 From: elijah Date: Wed, 20 Feb 2013 01:41:55 -0800 Subject: force valid utf8 for older versions of pandoc that barf on illegal utf-8 bytes. --- lib/static_page.rb | 2 ++ 1 file changed, 2 insertions(+) (limited to 'lib') diff --git a/lib/static_page.rb b/lib/static_page.rb index 6ad0c51..91032c7 100644 --- a/lib/static_page.rb +++ b/lib/static_page.rb @@ -10,6 +10,7 @@ require 'i18n' require 'pathname' require 'RedCloth' require 'pandoc-ruby' +require 'iconv' class StaticPage attr_accessor :path, :children, :name, :file_path, :props, :parent, :mount_point, :locales @@ -349,6 +350,7 @@ class StaticPage } def render_pandoc(string, suffix, locale) + string = Iconv.conv("UTF-8//IGNORE", "UTF-8", string) # remove illegal utf-8 args = [string, {:from => PANDOC_FORMATS[suffix], :to => :html}, "smart"] if props.locale(locale).toc != false args << "table_of_contents" -- cgit v1.2.3