Re: illegal characters

From: "Brett W(dot) McCoy" <bmccoy(at)chapelperilous(dot)net>
To: Oleg Lebedev <olebedev(at)waterford(dot)org>
Cc: <pgsql-general(at)postgresql(dot)org>
Subject: Re: illegal characters
Date: 2001-02-09 19:19:44
Message-ID: Pine.LNX.4.30.0102091417270.3832-100000@chapelperilous.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Fri, 9 Feb 2001, Oleg Lebedev wrote:

> I am using postgresql to store data passed from a web page. A user may
> enter whatever text she wants on that web page. Do I have to prepend all
> the illegal characters in the text with backslashes before storing the
> text in the database? Is there any way to make postgresql prepend these
> illegal characters for me?
> Example:
> I have an entry 'foo/bar' in a database table (it was stored as
> 'foo/bar' NOT as 'foo\/bar', when I try to search for all rows that
> contain entry 'foo/bar', I get no results.
> Any help will be greatly appreciated.

What programming interface are you using for the form? Most usually
provide some sort of escaping mechanism before you insert data into the
database. Otherwise, you can write your own validation functions (which
you should do any way, to make sure users aren't doing bad things) to
escape funncy characters (single quotes, slashes, etc.).

-- Brett
http://www.chapelperilous.net/~bmccoy/
---------------------------------------------------------------------------
This is National Non-Dairy Creamer Week.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Gilles DAROLD 2001-02-09 19:41:47 Re: ODBC with Visio
Previous Message Steven Saner 2001-02-09 19:17:26 ODBC with Visio