Re: Handling apostrophes and other characters

From: Steven Burn (nobody_at_PVT_it-mate.co.uk)
Date: 03/09/04


Date: Tue, 9 Mar 2004 19:11:31 -0000

hehe, the underscore was just an example (it's easier to see inside two
quotes than a ' is), I wasn't reccomending using any specific character.

--
Regards
Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk
Keeping it FREE!
Disclaimer:
I know I'm probably wrong, I just like taking part ;o)
Peter Foti <peter@Idontwantnostinkingemailfromyou.com> wrote in message
news:104s4jhhqd7d246@corp.supernews.com...
> "Steven Burn" <nobody@PVT_it-mate.co.uk> wrote in message
> news:%23JvwT7fBEHA.2796@TK2MSFTNGP09.phx.gbl...
> > theURL = "my cat's went into the dog's house"
> > theURL = Replace(theURL, "'", "_")
> >
> > Obviously the "_" can be whatever character you'd prefer (incase one of
> the
> > characters entered into the form is also an _ )
>
> Why would you suggest replacing it with an underscore?  Or anything other
> than 2 single quotes for that matter?  If you did that, then when you pull
> the data out to display, you would get:
>
> my cat_s went into the dog_s house
>
> And if you say that you just do a reverse replace on the data to be
> displayed, then you now have to find someway to escape real underscores.
> For example, if you wanted to replace underscores with the single quote in
> the data you display, then what if the original input string looked like
> this:
>
> my file is 'john_doe.txt'
>
> This would be converted to:
>
> my file is _john_doe.txt_
>
> So if you tried to replace the underscores with single quotes for display,
> the end result would be:
>
> my file is 'john'doe.txt'
>
> Which is obviously wrong.  In my opinion, it is NEVER a good idea to
modify
> data before storing it in the database.  Note that replacing a single
quote
> with 2 single quotes does NOT modify the data being stored in the
database.
>
> To answer Joe's original question, yes, replacing a single quote with 2
> single quotes for fields that contain non-numeric data (ie - not number
> fields) is still the best solution.  You shouldn't do it to all fields
> because you'll probably get a type mismatch if you try it on numeric data.
> And avoid any sort of JavaScript solution... there's no need for it.
>
> Regards,
> Peter Foti
>
>
>


Relevant Pages