Sha256: 8fda52026a224762157251df9a9de240b288779237b3052be6ad85a61443027f

Contents?: true

Size: 665 Bytes

Versions: 6

Compression:

Stored size: 665 Bytes

Contents

require 'feedparser/textconverters'

# Patch for REXML
# Very ugly patch to make REXML error-proof.
# The problem is REXML uses IConv, which isn't error-proof at all.
# With those changes, it uses unpack/pack with some error handling
module REXML
  module Encoding
    alias rexml_decode decode
    def decode(str)
      return str.toUTF8(@encoding)
    end

    alias rexml_encode encode
    def encode(str)
      return str
    end

    alias rexml_encoding= encoding=
    def encoding=(enc)
      return if defined? @encoding and enc == @encoding
      @encoding = enc || 'utf-8'
    end
  end

  class Element
    def children
      @children
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
ruby-feedparser-0.11.2 lib/feedparser/rexml_patch.rb
ruby-feedparser-0.11.1 lib/feedparser/rexml_patch.rb
ruby-feedparser-0.11.0 lib/feedparser/rexml_patch.rb
ruby-feedparser-0.10.0 lib/feedparser/rexml_patch.rb
ruby-feedparser-0.9.7 lib/feedparser/rexml_patch.rb
ruby-feedparser-0.9.6 lib/feedparser/rexml_patch.rb