Permalink
Browse files

Merge pull request #5 from andykent/patch-1

Allow changing of encoding
  • Loading branch information...
2 parents dd14a86 + 31ae812 commit 15cb43c486ed4a4353112b929041b3ad8a84fdc3 @cantino cantino committed Jul 23, 2011
Showing with 4 additions and 2 deletions.
  1. +4 −2 lib/readability.rb
View
6 lib/readability.rb
@@ -9,7 +9,8 @@ class Document
:remove_unlikely_candidates => true,
:weight_classes => true,
:clean_conditionally => true,
- :remove_empty_nodes => true
+ :remove_empty_nodes => true,
+ :encoding => 'UTF-8'
}.freeze
attr_accessor :options, :html
@@ -20,11 +21,12 @@ def initialize(input, options = {})
@remove_unlikely_candidates = @options[:remove_unlikely_candidates]
@weight_classes = @options[:weight_classes]
@clean_conditionally = @options[:clean_conditionally]
+ @encoding = @options[:encoding]
make_html
end
def make_html
- @html = Nokogiri::HTML(@input, nil, 'UTF-8')
+ @html = Nokogiri::HTML(@input, nil, @encoding)
end
REGEXES = {

0 comments on commit 15cb43c

Please sign in to comment.