[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

[MacPerl] escape oddities...



Hello all...

I thought that the sequence below would clean up any nasties from form 
data submitted through my cgi's. 

$form_data{$user_entry} =~ s/<(.|\n)*>//g;        # html
$form_data{$user_entry} =~ s/\t|\n|\r|\|/ /g;     # ht, nl, cr, pipe
$form_data{$user_entry} =~ s/ +/ /g;              # multi spaces
$form_data{$user_entry} =~ s/^ +| +$//g;          # starting & ending 
spaces

One concern being corruption of database files with \n or | characters. 
But after retrieving a db file via ftp (mac), I noticed what seemed to be 
newlines( /r's after fetch ingests them for my mac) breaking my records. 
The odd thing is that the unix server is ignoring the character and not 
seeing /n. - which is a good thing :)

The book, "Perl5 by Example" has a table listing all the usual escape 
char's, but, further into the book there is a code example using the 
escape /cM. A quick test verifies that MacPerl recognizes this as a /r.

The obvious solution for cgi's is to replace any whitespace char with a 
space. But is there any way to predict the way these things bounce from 
platform to platform?


Scott Prince

***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch