我想使用 JRuby 创建一些 XML 文件,但它不像 MRI Ruby 那样转义字符。
> "<node attr=#{'this is "my" complicated <String>'.encode(:xml => :attr)} />"
核磁共振
ruby-1.9.3-p194
=> "<node attr=\"this is "my" complicated <String>\" />"
JRuby
jruby-1.7.2
=> "<node attr=this is \"my\" complicated <String> />"