[thelist] Re: Adjusting strings for SQL

Aredridel aredridel at nbtsc.org
Mon Jul 14 21:13:23 CDT 2003

On Mon, 2003-07-14 at 19:29, Jerry Scannell wrote:
> This may sound like a "kluge", but what I do is change the apostrophes to `
> (I call it the backwards apostrophe since I don't know it's proper name.  It
> is found next to the 1 key.

Single backquote, or "backtick" as it's known.

> I, too, have always struggled with the double quote as a string delimiter,
> and an apostrophe as an allowable alternative.  What do you do when the
> apostrophe is part of the data.  

You use entities, that's what. <grin>.  " becomes &quot; and ' becomes
&#37;.  On the SQL side, you escape with backslashes or doubling as the
server you use requires:  ' -> \', and " -> \"

> My kluge takes care of it and nobody ever
> really notices.  For instance, O'Neil and O`Neil look almost identical.

And then someone tries to search for it and fails, and search engines
index it differently, quite possibly.


More information about the thelist mailing list