Module: Utf8StringPatch

Included in:
Nokogiri::XML::Nodeset, Nokogiri::XML::Text
Defined in:
lib/handsoap/service.rb

Overview

Nokogiri doesn’t have a way of getting plain strings out, so this monkeypatch adds that capability ..

Instance Method Summary collapse

Instance Method Details

#to_utf8Object



12
13
14
15
16
17
18
19
# File 'lib/handsoap/service.rb', line 12

def to_utf8
  # HTMLEntities.decode_entities(self.serialize(:encoding => 'UTF-8'))
  if Gem.loaded_specs['nokogiri'].version >= Gem::Version.new('1.3.0')
    self.serialize(:encoding => 'UTF-8').gsub('&lt;', '<').gsub('&gt;', '>').gsub('&quot;', '"').gsub('&apos;', "'").gsub('&amp;', '&')
  else
    self.serialize('UTF-8').gsub('&lt;', '<').gsub('&gt;', '>').gsub('&quot;', '"').gsub('&apos;', "'").gsub('&amp;', '&')
  end
end