Nokogiri 1.5.0
I'm unable to output a parsed fragment with a link having query parameters, specifically with the ampersand in the href. The ampersand is replaced by its html entity.
f = Nokogiri::HTML.fragment(%q{<a href="http://example.com?this=1&that=2">Testing</a>})
f.to_s # => "<a href=\"http://example.com?this=1&that=2\">Testing</a>"
f.to_html # => "<a href=\"http://example.com?this=1&that=2\">Testing</a>"
No help using to_html(encoding: 'UTF-8')
or US-ASCII.
This would seem pretty common, parsing a valid link format and wanting to render that back as valid HTML.
How to make Nokogiri transparently return un/encoded Html entities untouched? was no help.