Differences between XML string encoding in MRI and JRuby #561

Closed
dalton opened this Issue Mar 5, 2013 · 3 comments

Projects

None yet

5 participants

@dalton
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)} />"

MRI

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

JRuby

  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]).

@enebo
Member
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.

@tychobrailleur
Contributor

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