Implement XSS prevention for calls to _ method

There was a TODO in the _ method to include XSS prevention. I have implemented this prevention in order to fix a vulnerability in Jenkins. Escaping is done using the OWASP encoder.