Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Apostrophe in string appearing as a box when output to HTML

Posted on 2006-04-19
6
Medium Priority
?
319 Views
Last Modified: 2008-03-04
Hello, all!

I posted a similiar question in the past where I had the issue of a box appearing in instead of quotation marks...and this was solved....but I am still having the same issue with the apostrophe and I can't seem to get it to work.

A brief description:
I am pulling a series of strings from a mySQL database and storing them in a JavaScript array.  I am then cycling through these and displaying them in a rotating manner on the screen.  The strings are escape coded by PHP before they are placed into the JS array....I am then using the following JS function before outputting to the screen:

function URLDecode(psEncodeString)
{
  // Create a regular expression to search all +s in the string
  my_string = unescape(String(psEncodeString).replace(/\+/g, " "));
  my_string = my_string.replace(/\%3e/g,'"');
  my_string = my_string.replace(/[\x93\x94]/g,'"');
  return my_string;
}

This works great for the quotations...but I've tried adding another replace to remove the apostrophe without any luck.  I will paste an example of the string as I see it output to the screen (I see it as a box...but when the post to this thread occurs, it will show the character value).

...NOW’S THE TIME!  Check out these...

Any help would be MUCH appreciated.

Thanks in advance!
0
Comment
Question by:homemadebyx
6 Comments
 
LVL 11

Expert Comment

by:raj3060
ID: 16489726
Try this:


my_string = my_string.replace(/!+/g,'');

0
 
LVL 8

Expert Comment

by:KennyTM
ID: 16490067
tried add also the line

  my_string = my_string.replace(/’/g,"'");

before return-ing?
0
 
LVL 3

Author Comment

by:homemadebyx
ID: 16490546
raj3060 and KennyTM -

Tried both the solutions...unfortunately, neither has eliminated the box from appearing....

Thanks,
Steve
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 63

Accepted Solution

by:
Zvonko earned 2000 total points
ID: 16491664
Check this:

function URLDecode(psEncodeString) {
  my_string = unescape(String(psEncodeString).replace(/\+/g, " "));
  my_string = my_string.replace(/\%3e/g,'"');
  my_string = my_string.replace(/\x92/g,"'");
  my_string = my_string.replace(/[\x93\x94]/g,'"');
  return my_string;
}

0
 
LVL 3

Author Comment

by:homemadebyx
ID: 16491788
Zvonko -

You da' man!

Thanks!
0
 
LVL 63

Expert Comment

by:Zvonko
ID: 16491807
:-)
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I've been trying to accomplish this for a while and it just struck me yesterday how to accomplish this task. I have done searches all over the internet looking for ways to email pages from my applications and finally I have done it!!! Every single s…
A while back, I ran into a situation where I was trying to use the calculated columns feature in SharePoint 2013 to do some simple math using values in two lists. Between certain data types not being accessible, and also with trying to make a one to…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

578 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question