Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Unescape xml element content

113 views
Skip to first unread message

Jon Stenqvist

unread,
Jul 11, 2008, 8:37:30 AM7/11/08
to
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/.

Axel Etzold

unread,
Jul 11, 2008, 9:12:04 AM7/11/08
to

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

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!
http://games.entertainment.gmx.net/de/entertainment/games/free/puzzle/6169196

matt neuburg

unread,
Jul 11, 2008, 11:02:05 AM7/11/08
to
Jon Stenqvist <j...@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>

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.
--
matt neuburg, phd = ma...@tidbits.com, http://www.tidbits.com/matt/
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

0 new messages