Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(jruby) Node#content= incompatibility #839

Closed
flavorjones opened this issue Jan 18, 2013 · 1 comment
Closed

(jruby) Node#content= incompatibility #839

flavorjones opened this issue Jan 18, 2013 · 1 comment

Comments

@flavorjones
Copy link
Member

From https://groups.google.com/d/msg/nokogiri-talk/-/cGJk1BBRXygJ

Using Nokogiri 1.5.6:

#! /usr/bin/env ruby

require 'nokogiri'

d1=Nokogiri::XML('<r><a>text</a></r>')
d2=Nokogiri::XML('<r></r>')
ne=d1.root.xpath('//a').first.dup(1)
ne.content += "& < & > \" &"
d2.root << ne
puts d2.to_s

On MRI 1.9.3, output is:

<?xml version="1.0"?>
<r>
  <a>text&amp; &lt; &amp; &gt; " &amp;</a>
</r>

On JRuby 1.7.1, output is:

<?xml version="1.0"?>
<r><a>text&amp;amp; &amp;lt; &amp;amp; &amp;gt; " &amp;amp;</a></r>

Note the double-escaping on JRuby.

@benlangfeld
Copy link
Contributor

This is similar to #794. This may give a guide to the appropriate fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants