What is the simplest way to replace quote characters with \” sequence inside string values?
What is the simplest way to replace quote characters with \ sequence inside string
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
That’ll be the
fn:replace()function.Unrelated to the concrete question, this is an often recurring requirement in order to prevent malformed HTML when redisplaying user controlled input as a HTML attribute. Normally, you should use
<c:out>orfn:escapeXml()for this instead. E.g.It not only takes quotes into account, but also all other XML special characters like
<,>,&, etc.See also: