[clug-talk] Scrubbing/Sanitazing routine

Shawn sgrover at open2space.com
Thu Sep 29 15:40:00 PDT 2005


Do a search for HTML Entities with regards to Java.  PHP has htmlentities() 
and htmlspecialchars() function that does something similar to what you're 
asking for.  I'm sure there would be some kind of equivalent in Java.

Shawn

On Thursday 29 September 2005 15:37, Cirez Communications, inc. wrote:
> 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.
> =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=
>
> _______________________________________________
> clug-talk mailing list
> clug-talk at clug.ca
> http://clug.ca/mailman/listinfo/clug-talk_clug.ca
> Mailing List Guidelines (http://clug.ca/ml_guidelines.php)
> **Please remove these lines when replying
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://clug.ca/pipermail/clug-talk_clug.ca/attachments/20050929/c6bb2814/attachment.bin


More information about the clug-talk mailing list