Skip to content

Commit

Permalink
Iconv: made test/test_util/html_parser.rb pass
Browse files Browse the repository at this point in the history
  • Loading branch information
ngiger committed Jun 17, 2014
1 parent 6d1d564 commit c3cfa6a
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/util/html_parser.rb
Expand Up @@ -6,7 +6,6 @@

require 'util/html-parser'
require 'util/formatter'
require 'iconv'

module ODDB
class NullWriter < ::NullWriter
Expand All @@ -17,7 +16,6 @@ def send_image(src); end
def send_meta(attributes); end
end
class BasicHtmlParser < HTMLParser
iconv = Iconv.new('utf-8', 'iso-8859-1')
entities = {}
[
'nbsp', 'iexcl', 'cent', 'pound', 'curren',
Expand All @@ -42,7 +40,7 @@ class BasicHtmlParser < HTMLParser
'yuml',
].each_with_index { |name, idx|
# Html-Entities start at chr 160
entities.store(name, iconv.iconv((idx + 160).chr))
entities.store(name, (idx + 160).chr.encode("UTF-8", 'iso-8859-1', :invalid => :replace, :undef => :replace, :replace => "?"))
}
Entitydefs = entities

Expand Down

0 comments on commit c3cfa6a

Please sign in to comment.