From: Joshua Haberman Date: 2005-09-06T01:34:15+09:00 Subject: Re: Encoding hell --Apple-Mail-3--545520846 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed On Sep 5, 2005, at 9:26 AM, Zach Dennis wrote: > On Tue, 2005-09-06 at 00:58 +0900, Christian Neukirchen wrote: > >>> >>> Another way of looking at this: you're getting one XML document >>> embedded in another: >>> >>> enclosing_doc = REXML::Document.new(str) >>> real_doc = REXML::Document.new(enclosing_doc.elements["/ >>> string"].text) >>> >>> > > Good call. then unescape real_doc... No, that's the whole point. All escapes were interpreted when you parsed enclosing_doc, and replaced by their corresponding characters. The text of the element is itself a valid XML document, and incidentally, the XML document you really care about. Try "puts enclosing_doc.elements["/string"].text", and it should all make more sense. Josh --Apple-Mail-3--545520846--