...
As with input validation, normalized normalize data before filtering for malicious characters. To avoid vulnerabilities caused data that may bypass validation, we recommended that all output characters other than those known to be safe should be encoded.
...