From e1a705f975f538c2d9a7132479fa727ef2332fc3 Mon Sep 17 00:00:00 2001 From: bootstraponline Date: Thu, 29 Nov 2012 20:05:41 -0700 Subject: [PATCH] Fix UTF-8 to_html uses source document encoding by default. Set UTF-8. Add note about KCODE warning. --- lib/gollum.rb | 2 ++ lib/gollum/frontend/views/page.rb | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/gollum.rb b/lib/gollum.rb index 69701208..b2d3d992 100644 --- a/lib/gollum.rb +++ b/lib/gollum.rb @@ -24,6 +24,8 @@ require File.expand_path('../gollum/web_sequence_diagram', __FILE__) require File.expand_path('../gollum/frontend/uri_encode_component', __FILE__) # Set ruby to UTF-8 mode +# Do not remove because of warning. +# This is required for Ruby 1.8.7 which gollum still supports. $KCODE = 'U' module Gollum diff --git a/lib/gollum/frontend/views/page.rb b/lib/gollum/frontend/views/page.rb index 9dbcbb8b..a359e66a 100644 --- a/lib/gollum/frontend/views/page.rb +++ b/lib/gollum/frontend/views/page.rb @@ -134,7 +134,7 @@ module Precious def page_header_from_content(content) doc = build_document(content) title = find_header_node(doc) - Sanitize.clean(title.to_html).strip unless title.empty? + Sanitize.clean(title.to_html(:encoding => 'UTF-8')).strip unless title.empty? end # Returns page content without title if it was extracted.