[clug-talk] Scrubbing/Sanitazing routine

Cirez Communications, inc. jacirez at gmail.com
Thu Sep 29 14:37:42 PDT 2005


Quick q:

In trying to sanitaze user input (I know, I know, there is no easy way
to do this), is there is rather fast/uncomplicated way to accomplish
this?

A quick and dirty way to do this in perl is to create a hash with the
ilegal characters and its replacements (key/value), then create a sub
that takes a dirty string as argument, look it up and return the
sanitized version. This is all well and good; but trying to do the
same in Java it's rather resource intensive.

Is there a simple way to accomplish this, given a list of 25 or so
character to scrubb? I don't want to delete the characters just return
the ASCII code in HTML compatible format i.e ASCII (67) as C
Using  java's: (Object).replace(dirty_string, sanitized_string); for
every possible character takes way to much time and resources...
--
=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=
-------------------Cirez Communications, inc.----------------
----------------------Juan Alberto Cirez---------------------
-----------------------Senior Consultant---------------------
-----------------------jacirez at gmail.com---------------------
=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=
          Sunny and Beautiful Vancouver, Canada.
=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=



More information about the clug-talk mailing list