PDA

View Full Version : escaping double quotes


pdstein
11-06-2000, 04:11 PM
I have a PHP script that I was using in an account on SIX that is acting differently on DEXTER.[nbsp][nbsp]It's just a simple file editor.[nbsp][nbsp]It opens a text file and display the contents in the TEXTAREA of a form.[nbsp][nbsp]I can make changes to the file and then save it.[nbsp][nbsp]As a said it worked fine on SIX, but on DEXTER I find that a slash is automatically added before a double quote and it adds a slash before a slash.

echo "This is a test.
"; becomes
echo \"This is a test.
\";

and

echo \"This is a test.
\"; becomes
echo \\\"This is a test.
\\\";

Does anyone know anything about this?[nbsp][nbsp]Or how I can correct for it?[nbsp][nbsp]I tried all kinds of ereg_replace lines, but none of them worked.[nbsp][nbsp]Thanks for your help.

Justin
11-06-2000, 04:26 PM
The simplest way to fix this would be to use PHP's built-in </font><font face="Courier" size="3">stripslashes()</font><font face="Verdana, Arial" size="2"> function:
</font><font face="Courier" size="3">
$text = stripslashes($text);
</font><font face="Verdana, Arial" size="2">
As for the script behaving differently on the different servers, we will look into that...

------------------
Justin Nelson
FutureQuest (http://www.FutureQuest.net/index.php) Support