Single/double quotes in MySQL database

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
User avatar
Bill H
DevNet Resident
Posts: 1136
Joined: Sat Jun 01, 2002 10:16 am
Location: San Diego CA
Contact:

Single/double quotes in MySQL database

Post by Bill H »

Using MySQL Ver 4.0.27-standard and PHP 4.4.4 (not able to change, shared server). Magic_quotes_gpc is turned on.

Problem arises when text/varchar field contains single/double quotes. Sometimes that is not a problem, other times the quotes are replaced by multiple unprintable characters which display in browser as single/double quotes but cause a spellchecker to crash. In phpmyadmin they show as hyroglyphics.

The application has been in place for a bit over a year without any problems and this has only recently begun to happen. It is rare and inconsistent. Sometimes within a single row some fields will contain the quotes okay while other fields in the same row will be trashed.

Can anyone point me in the direction of what is happing and how to solve it?
User avatar
Weirdan
Moderator
Posts: 5978
Joined: Mon Nov 03, 2003 6:13 pm
Location: Odessa, Ukraine

Post by Weirdan »

Sometimes that is not a problem, other times the quotes are replaced by multiple unprintable characters which display in browser as single/double quotes but cause a spellchecker to crash.
Could you provide a sample of these multiple unprintable characters (hex encoded byte values)? Chances are these characters are utf sequences, but I can't be sure without seeing them.
User avatar
Bill H
DevNet Resident
Posts: 1136
Joined: Sat Jun 01, 2002 10:16 am
Location: San Diego CA
Contact:

Post by Bill H »

Like this, instead of
[quote]me and said, "hello."
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Post by pickle »

I'd guess that somehow the encoding-type of the string is getting mis interpreted. I've not done any work with that so I wouldn't know what to do.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
Post Reply