removing whitespace from the end of user-provided data, encoding param values