[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Unescape xml element content

Jon Stenqvist

7/11/2008 12:38:00 PM

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-....

2 Answers

Axel Etzold

7/11/2008 1:12:00 PM

0


-------- 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-....
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/puzz...

matt

7/11/2008 3:02:00 PM

0

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>

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 = matt@tidbits.com, http://www.tidbits...
Leopard - http://www.takecontrolbooks.com/leopard-custom...
AppleScript - http://www.amazon.com/gp/product/...
Read TidBITS! It's free and smart. http://www.t...