Re: Handling apostrophes and other characters

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: Joe Van Meer (vanmeer_at_accesscable.net)
Date: 03/09/04


Date: Tue, 9 Mar 2004 14:58:01 -0400

Thx Fellas!!! Appreciate your input!

"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

  • Re: Handling apostrophes and other characters
    ... Why would you suggest replacing it with an underscore? ... then you now have to find someway to escape real underscores. ... the data you display, then what if the original input string looked like ... So if you tried to replace the underscores with single quotes for display, ...
    (microsoft.public.inetserver.asp.general)
  • Re: Handling apostrophes and other characters
    ... quotes than a ' is), I wasn't reccomending using any specific character. ... then you now have to find someway to escape real underscores. ... > the data you display, then what if the original input string looked like ... > So if you tried to replace the underscores with single quotes for display, ...
    (microsoft.public.inetserver.asp.general)
  • Re: asp:image not visible when dynamic
    ... not sure why as I had single quotes originally...sheesh programming ... Deere wrote: ... I overwrote a letter when changing the slashes ... static path of Image2 which is / it will display. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Single Quotes in gcc
    ... correclty even when i change the encoding to UTF-8. ... Anyone know anything I can do to get the single quotes to display ...
    (comp.terminals)
  • Re: sed and bash-script --- help in search and replace content of file.
    ... First, you put variables between single quotes when invoking sed, so the ... corrected the first problem the file data_file would still remain unchanged. ... now it is only replacing First Value... ... redirecting to output file. ...
    (comp.unix.shell)