It is a clients responsibility to escape the string so these characters should not occur in the input unescaped. I should have mentioned that in javadoc.