How to make Nokogiri transparently return un/encoded Html entities untouched?
- by svenfuchs
How can I use Nokogiri with having html entities (like German umlauts) untouched?
I.e.:
# this is fine
node = Nokogiri::HTML.fragment('<p>ö</p>')
node.to_s # => '<p>ö</p>'
# this is not
node = Nokogiri::HTML.fragment('<p>ö</p>')
node.to_s # => '<p>ö</p>'
# this is what I need
node = Nokogiri::HTML.fragment('<p>ö</p>')
node.to_s # => '<p>ö</p>'
I've tried to mess with both PARSE_OPTIONS and :save_with options but could not come up with a way to have Nokogiri just transparently behave like above.
Any pointers?