?
Solved

How do I unescape quotes?

Posted on 2011-05-02
5
Medium Priority
?
523 Views
Last Modified: 2012-06-22
Is there a function that will sanitize posts so the silly &quot will get turned back into real quotes?


\"This should be properly quoted.\"

Open in new window

0
Comment
Question by:DrDamnit
  • 2
  • 2
5 Comments
 
LVL 9

Accepted Solution

by:
Vampireofdarkness earned 2000 total points
ID: 35506075
If you're only reversing one...

$string="\"This should be properly quoted.\"";
$string=preg_replace("=\\\"=","\"",$string);

OR

$string="\"This should be properly quoted.\"";
$string=preg_replace("=\\\&=","&",$string);

The latter will do more than just "
0
 
LVL 32

Author Comment

by:DrDamnit
ID: 35506806
I was hoping there was a function that would do all the random escapings...
0
 
LVL 9

Expert Comment

by:Vampireofdarkness
ID: 35506826
You can also use stripslashes(), but that'll remove all escaped characters, not just \&
0
 
LVL 48

Expert Comment

by:hernst42
ID: 35510281
You could try:


echo html_entity_decode(stripslashes("\"This should be properly quoted.\""));

Open in new window

0
 
LVL 32

Author Closing Comment

by:DrDamnit
ID: 35812848
Not what I was hoping for, but what I was hoping for doesn't exist. :-)
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Suggested Courses
Course of the Month15 days, 15 hours left to enroll

850 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