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 "my" complicated <String>\" />"
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]).