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

Differences between XML string encoding in MRI and JRuby #561

dalton opened this Issue Mar 5, 2013 · 3 comments


None yet
5 participants
Copy link

dalton commented Mar 5, 2013

I'd like to use JRuby to create some XML files, but it is not escaping characters in the same way MRI Ruby does.

> "<node attr=#{'this is "my" complicated <String>'.encode(:xml => :attr)} />"


  ruby-1.9.3-p194 => "<node attr=\"this is &quot;my&quot; complicated &lt;String&gt;\" />"


  jruby-1.7.2 => "<node attr=this is \"my\" complicated <String> />"

This is a contrived example to show the differences between the two Ruby implementations of String#encode(:xml => [attr|text]).


This comment has been minimized.

Copy link

enebo commented Mar 5, 2013

Yeah. Unfortunately, this is a known problem. We accept the option but it is current unimplemented. I do think we have an issue open for this but I cannot locate it atm (so I will leave this open). The good news is that some recent refactoring will make fixing this a little bit easier, but we are not specifically working on it. For sure if this is not addressed for 1.7.4 it will be for 1.7.5.


This comment has been minimized.

Copy link

retoo commented May 16, 2013


This comment has been minimized.

Copy link

tychobrailleur commented May 16, 2013

This was fixed by #684 and should be available in 1.7.4.

@atambo atambo closed this May 17, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.