Replacing single quote does not work
Posted: Thu Jan 20, 2011 2:20 am
I am trying to do the seemingly simple thing - replace all single quotes in html output.
It does not replace anything.
The code line is within function where other lines work perfectly.
And yes, someone tried to run it on their server and it all works including single quote. Not on mine.
I tried escaping single quote, used other similar functions (preg_replace, str_replace) - nope.
Tried htmlspecialchars - nope.
I did look at html source. Did read FAQs and manuals. I tried hard to google. I posted to other help forum. With no luck so far.
I have standard CentOS build, did not edit php.ini. Here is php_ini page http://maidan.org.ua/test.php
What would be wrong there?
Any help would ne much appreciated.
Code: Select all
ereg_replace ("'", "'", $text);The code line is within function where other lines work perfectly.
Code: Select all
function convert_quotes ($text) {
$text = ereg_replace ('"', """, $text);
$text = ereg_replace ("'", "", $text);
$text = ereg_replace ('“', "“", $text);
$text = ereg_replace ('”', "”", $text);
$text = ereg_replace ('‘', "‘", $text);
$text = ereg_replace ('’', "’", $text);
$text = ereg_replace ('«', "«", $text);
$text = ereg_replace ('»', "»", $text);
return $text;
}I tried escaping single quote, used other similar functions (preg_replace, str_replace) - nope.
Tried htmlspecialchars - nope.
I did look at html source. Did read FAQs and manuals. I tried hard to google. I posted to other help forum. With no luck so far.
I have standard CentOS build, did not edit php.ini. Here is php_ini page http://maidan.org.ua/test.php
What would be wrong there?
Any help would ne much appreciated.