[FX.php List] Yet another annoying single-quotes problem

Roger Moffat rogerkiwi at aol.com
Fri Apr 27 20:01:14 MDT 2007


On Apr 27, 2007, at 8:35 PM, Bob Patin wrote:

> Well, I finally did an end-run and fixed it by using this:
>
>
> $hospital = str_replace("’","'",$hospital);
>
> and it works fine... strange though that there's not an easier way...

You could do a more wide ranging change using something like what  
I've put into some PHP scripts I've worked on for my genealogy web  
site to pass stuff to Google Maps for drawing maps

$message=str_replace($banish, $banreplace, $messsage)

then set up two arrays

$banish = array("’");
$banreplace = array("'");

which can be added to as you find other gremlins that cause problems.

I ended up using arrays as when we first needed this it was to deal  
with ( and ) which Google couldn't handle, but grew to be currently 8  
different characters that cause problems.

Then you can also use these same arrays on other fields too if the  
need arises - subject of the eMail for example.

Cheers

Roger



More information about the FX.php_List mailing list