ruhoh / ruhoh.rb

http://ruhoh.com
616 stars 69 forks source link

FIXED: PageViewable#summary ruins non-ASCII summaries #246

Closed mudasobwa closed 10 years ago

mudasobwa commented 10 years ago

Summaries in index pages became a crap bundle of encoded hash-entities, preventing proper search-engine indexing.

The patch follows (excuse me for I have not pull request provided, but I had totally messed my fork up; hopefully the fix is as clear as possible).

diff --git c/lib/ruhoh/base/model_view.rb w/lib/ruhoh/base/model_view.rb
index 7ffe46e..13fde19 100644
--- c/lib/ruhoh/base/model_view.rb
+++ w/lib/ruhoh/base/model_view.rb
@@ -106,7 +106,7 @@ module Ruhoh::Base

       # Return a summary element if specified
       summary_el = content_doc.at_css('.summary')
-      return summary_el.to_html unless summary_el.nil?
+      return summary_el.to_html(:encoding => 'UTF-8') unless summary_el.nil?

       # Get the configuration parameters
       # Default to the parameters provided in the page itself
@@ -154,7 +154,7 @@ module Ruhoh::Base
         summary_doc << node
       end

-      summary_doc.to_html
+      summary_doc.to_html(:encoding => 'UTF-8')
     end

     def next
plusjade commented 10 years ago

:+1: thanks for you help!