From: rnanba@... Date: 2018-09-02T09:25:48+00:00 Subject: [ruby-dev:50626] [Ruby trunk Bug#15058] REXML::Text#clone returns a text node with a double escaped Sting Issue #15058 has been reported by rna (Ryosuke Nanba). ---------------------------------------- Bug #15058: REXML::Text#clone returns a text node with a double escaped Sting https://bugs.ruby-lang.org/issues/15058 * Author: rna (Ryosuke Nanba) * Status: Open * Priority: Normal * Assignee: * Target version: * ruby -v: ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-linux-gnu] * Backport: 2.3: UNKNOWN, 2.4: UNKNOWN, 2.5: UNKNOWN ---------------------------------------- `REXML::Text#clone` で生成したオブジェクトが元のオブジェクトと異なる値を持ったテキストノードになります。clone されたテキストノードの `to_s` の値は、元のテキストノードが表現する文字列を二重にエスケープしたものになります。 例: ~~~ require 'rexml/document' t = REXML::Text.new("< <", false, nil, false) t2 = t.clone t.to_s # => "&lt; <" t2.to_s # => "&amp;lt; &lt; (expected: "&lt; <") t == t2 # => false (expected: true) ~~~ clone したテキストノードの値は元のテキストノードと同じ値になるべきです。 -- https://bugs.ruby-lang.org/