What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » [Question] How to decode HTML codes?

[Question] How to decode HTML codes?
Author: Message:
tryxter
Junior Member
**

Avatar
A. Maia Ferreira @ PTnet

Posts: 51
Reputation: 1
35 / Male / –
Joined: Jan 2007
O.P. [Question] How to decode HTML codes?
Any idea on how to decode this kind of html codes?
I've already tried decodeURI() and it doesn't work (at least as expected).

ÁFRICA

I hope the solution doesn't pass by creating a switch for every encoded word... :-#

01-11-2007 01:36 PM
Profile E-Mail PM Find Quote Report
Silentdragon
Full Member
***

Avatar
if(life==null && wrists) EmoAlert();

Posts: 148
Reputation: 2
34 / Male / –
Joined: Jun 2006
RE: [Question] How to decode HTML codes?
decodeURI()
decodeURIComponent()

I tried with both of those and it gave me the letter Á which is what it is.

I even tried unescape() which works fine too.

So not sure what to say, unless maybe you can further explain the how it doesn't work as expected.
01-11-2007 06:03 PM
Profile E-Mail PM Web Find Quote Report
tryxter
Junior Member
**

Avatar
A. Maia Ferreira @ PTnet

Posts: 51
Reputation: 1
35 / Male / –
Joined: Jan 2007
O.P. RE: [Question] How to decode HTML codes?
Can you explain how you did it? I've tried, but somehow it didn't decoded successfully...

I've tried decodeURI("Á"); and it returns the same thing (Á).
I guess I'm doing something wrong... :\

Thanks

This post was edited on 01-11-2007 at 06:39 PM by tryxter.
01-11-2007 06:26 PM
Profile E-Mail PM Find Quote Report
tryxter
Junior Member
**

Avatar
A. Maia Ferreira @ PTnet

Posts: 51
Reputation: 1
35 / Male / –
Joined: Jan 2007
O.P. RE: [Question] How to decode HTML codes?
Can anyone answer the question, please?

Thanks
01-12-2007 07:43 PM
Profile E-Mail PM Find Quote Report
albert
Veteran Member
*****

Avatar

Posts: 2247
Reputation: 42
– / Male / Flag
Joined: Feb 2005
RE: [Question] How to decode HTML codes?
Á is a simple code to replace a letter
to "decode" you can simple check the codes significations here :

http://www.ascii.cl/htmlcodes.htm

This post was edited on 01-12-2007 at 07:47 PM by albert.
01-12-2007 07:47 PM
Profile E-Mail PM Web Find Quote Report
tryxter
Junior Member
**

Avatar
A. Maia Ferreira @ PTnet

Posts: 51
Reputation: 1
35 / Male / –
Joined: Jan 2007
O.P. RE: [Question] How to decode HTML codes?
That was only an example... There are many more characters too translate.
01-12-2007 07:52 PM
Profile E-Mail PM Find Quote Report
Mnjul
forum super mod
******

Avatar
plz wub me

Posts: 5396
Reputation: 58
– / Other / Flag
Joined: Nov 2002
Status: Away
RE: [Question] How to decode HTML codes?
If you are able to extract the number (193 in your example) from the string, then you can call the fromCharCode method of String

Example:
code:
var s="193";
var c=parseInt(s);
var s2=String.fromCharCode(c);
Debug.Trace(s2);


This post was edited on 01-12-2007 at 08:20 PM by Mnjul.
01-12-2007 08:18 PM
Profile PM Web Find Quote Report
tryxter
Junior Member
**

Avatar
A. Maia Ferreira @ PTnet

Posts: 51
Reputation: 1
35 / Male / –
Joined: Jan 2007
O.P. RE: [Question] How to decode HTML codes?
I guess that's a better solution.
Anyway, if someone finds out how to work with decodeURI(), can be the best solution.

Thanks again

This post was edited on 01-13-2007 at 01:30 AM by tryxter.
01-13-2007 12:38 AM
Profile E-Mail PM Find Quote Report
Eljay
Elite Member
*****

Avatar
:O

Posts: 2949
Reputation: 77
– / Male / –
Joined: May 2004
RE: [Question] How to decode HTML codes?
Just made a little function for removing html codes in this format (i would add support for all the & style codes but theres too many of the darned things :P)

function: (one line, ok kinda long line but still one line!)
code:
function htmldecode(encodedString){ return encodedString.replace(/&#([0-9]+);/g, function(a,b){ return String.fromCharCode( b); } ); }

example:
code:
htmldecode("Hello World"); //returns "Hello World"
01-13-2007 10:42 AM
Profile PM Find Quote Report
« Next Oldest Return to Top Next Newest »


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On