java - Prevent Jsoup from discarding extra whitespace -


I am using Jess oup to configure user input from a form. In the form in question, a & Lt; Textarea & gt; which is expected to be plain text when the form is submitted, then I clean the input with the Jsoup.clean (textareaContents) ; However, because HTML ignores additional white space, will remove characters from precious white space from Jsoup.clean () input. For example, if any Textarea :

  Hello Test   

after Jsoup.clean () , you will have:

  Hello test   

How can you create Jsoup.clean () white space Protect? I know that this is designed to parse the html and this is not html, is there a better option?

If your teddyara just looks for plain text, then I think you should avoid plain text To be better than just HTML. To wit. The user's input & lt; and & gt; tag to & amp; Lt; and & amp; Gt; . Either on our output input (input may be secure so that you only need to think about it once.)

It is, as you say, to analyze untrusted input HTML Designed for, and with reliable HTML elements, where the elements have been drafting

Comments