class Loofah::Scrubbers::Unprintable

scrub!(:unprintable)

:unprintable removes unprintable Unicode characters.

markup = "<p>Some text with an unprintable character at the end\u2028</p>"
Loofah.html5_fragment(markup).scrub!(:unprintable)
=> "<p>Some text with an unprintable character at the end</p>"

You may not be able to see the unprintable character in the above example, but there is a U+2028 character right before the closing </p> tag. These characters can cause issues if the content is ever parsed by JavaScript - more information here:

http://timelessrepo.com/json-isnt-a-javascript-subset