use this and make what you need from it.
/** * Removes any characters which are not valid to be passed on the URL. */
static function string StripInvalidPasswordCharacters( string PasswordString, optional string InvalidChars=" \"/:?,=" )
{
local int i;
for ( i = 0; i < Len(InvalidChars); i++ )
{
PasswordString = Repl(PasswordString, Mid(InvalidChars, i, 1), "");
}
return PasswordString;
}