Unescape xml element content

Is there a way to unescape this string?

<name>L&#xE4;tt B bed. Tv&#xE5; omg&#xE5;ngar A:0 och A:0</name>

···

--
Posted via http://www.ruby-forum.com/.

-------- Original-Nachricht --------

Datum: Fri, 11 Jul 2008 21:37:30 +0900
Von: Jon Stenqvist <jon@equipe.nu>
An: ruby-talk@ruby-lang.org
Betreff: Unescape xml element content

Is there a way to unescape this string?

<name>L&#xE4;tt B bed. Tv&#xE5; omg&#xE5;ngar A:0 och A:0</name>
--
Posted via http://www.ruby-forum.com/\.

Dear John,

require "CGI"
p CGI.unescapeHTML("<name>L&#xE4;tt B bed. Tv&#xE5; omg&#xE5;ngar A:0 och A:0</name>")

should do it.

Best regards,

Axel

···

--
GMX Kostenlose Spiele: Einfach online spielen und Spaß haben mit Pastry Passion!

I think this works correctly:

require 'rexml/document'
s = "<name>L&#xE4;tt B bed. Tv&#xE5; omg&#xE5;ngar A:0 och A:0</name>"
puts REXML::Text::unnormalize(s)

m.

···

Jon Stenqvist <jon@equipe.nu> wrote:

Is there a way to unescape this string?

<name>L&#xE4;tt B bed. Tv&#xE5; omg&#xE5;ngar A:0 och A:0</name>

--
matt neuburg, phd = matt@tidbits.com, Matt Neuburg’s Home Page
Leopard - http://www.takecontrolbooks.com/leopard-customizing.html
AppleScript - http://www.amazon.com/gp/product/0596102119
Read TidBITS! It's free and smart. http://www.tidbits.com