Skip to main content.
home | support | download

Back to List Archive

Re: [SWISH-E:268] Wierd apostrophe problem!!

From: David Dunson <dunson(at)>
Date: Sat May 02 1998 - 20:04:00 GMT
On Thu, 30 Apr 1998, stuart wrote:

> I am inches away from getting SWISH-E to work but ran into a small but
> mighty snag. I run SWISH-E on BSD UNIX and the program is called from a

If you are typing the names from an HTML form and using the CGI module to
read it, the program will puke no matter what you do inside your perl
script.  (I assume that is what you are trying to do...)
In this case, you must replace the ' with the escape %27 before you post
the text field.  You could use an onSubmit handler to call to "escape" the
text field before it is submitted, i.e. convert spaces to %20, ' to %27,
etc., though I THINK that if you use the
"get" method of posting, the browser will escape the posted strings for
you.  If not, the JavaScript function "escape" will do it.

Inside your perl script, the $name variable (or whatever you are using)
should require no special treatment, though if it does you can try the
other people's wonderful suggestions. :)

At any rate, I did test the CGI module with names that had ' in them,
and you can't pass them in at all without escaping them first.  (The error
message came up even when I did something like

#! /usr/local/bin/perl
use CGI;
$query = new CGI;

and NOTHING else.)

Hope this helps.

David Dunson
South Central R*TEC programmer
Received on Sat May 2 13:12:59 1998