Fix for Bug 37131 - Escape newlines in the Validator variables - code copied from Velocity Tools project (see JIRA issue VELTOOLS-52), thanks to Christopher Schultz and Nathan Bubna.