Decoding a string in Javascript

This is a discussion on "Decoding a string in Javascript" within the JavaScript Forum section. This forum, and the thread "Decoding a string in Javascript are both part of the Program Your Website category.


 Subscribe in a reader

Go Back   Webforumz.com > Main Forums > Program Your Website > JavaScript Forum

Notices




Reply
 
LinkBack Thread Tools
  #1  
Old Jun 11th, 2008, 22:58
New Member
Join Date: Jun 2008
Location: California
Age: 28
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Decoding a string in Javascript

I am having a hard time in decoding this string in javascript

'


I am using the following code
_______________________
text="'";
var output=text.unescapeHTML();

document.write(output);
_______________________

It shows '

I would like to decode it further to just a single quote

since entity code for single quote = '

I tried to use the above function in a for loop but still it gives me same result.

Any help would be greatly appreciated

Anuj

Last edited by Aso; Jun 12th, 2008 at 16:00. Reason: No signature until 25 posts
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote

  #2  
Old Jun 12th, 2008, 16:07
Aso's Avatar
Aso Aso is offline
Moderator

SuperMember
Join Date: Oct 2007
Location: UK
Posts: 1,344
Blog Entries: 2
Thanks: 11
Thanked 50 Times in 47 Posts
Re: Decoding a string in Javascript

Correct me if I'm wrong, but I think unescape only works with url encoded characters.

Instead, I think you're looking for something like this - script to convert HTML entities.
Last Blog Entry: The Google Misconception (Feb 3rd, 2008)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Reverse a string... Anonymous User Classic ASP 4 Jun 6th, 2008 09:16
Javascript problem - unterminated string jitumandalia JavaScript Forum 2 Feb 14th, 2008 07:43
Get value from SQL string ? VegaLA Classic ASP 5 Jan 30th, 2008 07:39
Problem with ["] and ['] in javascript string beckkp JavaScript Forum 3 Sep 13th, 2007 06:20
string capacity Don Logan JavaScript Forum 11 Sep 23rd, 2006 20:28


All times are GMT. The time now is 05:04.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved