I use Jsoup to sanitize user input from a form. The form in question is contained <textarea>, which expects plain text. When the form is submitted, I clear the input with Jsoup.clean(textareaContents); however, since html ignores extra spaces, it Jsoup.clean()removes valuable space characters from input.
For example, if someone entered some lines of text in textarea:
hello
test
after Jsoup.clean(), you will receive:
hello test
How to Jsoup.clean()save spaces? I know that it is designed to parse html, and it is not html, so is there a better alternative?
source
share