Click to See Complete Forum and Search --> : Escaping Characters... A curious problem.


chestertb
04-03-2004, 04:10 AM
Hi all,

I have a content management system for one of our sites, that uses PHP and MySQL to create and store editorial for e-magazine articles.

As I tend to write informally, I use the " ' " a great deal... as in "we're", or "they're".

On the server, no problem. Either PHP or MySQL (I haven't figured out which) is smart enough to know what to do, and the records update without problem.

On my local machine, which I use for development and testing of new scripts, and which has the same versions of PHP and MySQL as the server, I can not use " ' " without escaping the character in the text field.

The server, by the way, runs Linux, while my desk runs Windoze 2K.

Is there a setting somewhere?
Have I misconfigured something?
Does anyone else think getting all of these things to talk to each other should be easier than it is?

Thanks
CTB

shimon
04-03-2004, 01:11 PM
i suppose the lesson there is that windows might not be a suitable development environment ;) (well, it certainly isn't if your production code is on linux)

but something like this may be pretty simple to work around

check your php.ini on your windows box - the problem is probably that the magic_quotes directive is off, whilst on the linux box it is set to on

On that topic, I found an interesting article by Harry Fuecks here:

http://www.webmasterstop.com/tutorials/php-magic-quotes.shtml

sadly some of the code examples dont show up properly there, but the gist of it should be legible

Webskater
04-05-2004, 09:43 AM
Given the endless problems with single quotes in SQL and in javascript, I use a function to replace every single quote in text with a typographer's quotation mark. This fixes everything.

chestertb
04-05-2004, 10:16 AM
Thanks guys.

Changing the php.ini file did the trick.

CTB