Handling Special Characters in JSP

Discussions

Web tier: servlets, JSP, Web frameworks: Handling Special Characters in JSP

  1. Handling Special Characters in JSP (2 messages)

    Hi Iam getting Item Name from Data Base that contains Sp Chars like ',"/- etc. When Iam displaying the same it is throwing java script error(; expected). Also when sending the same via URL to new window also it is throwing exceptions. How to handle this? Regards B S Reddy
  2. Re: Handling Special Characters in JSP[ Go to top ]

    you don't. decode them to UTF-8 before displaying them... make sure your database is set to UTF-8 encoding as well, if your using one.
  3. Try Commons Lang's StringEscapeUtils[ Go to top ]

    You could also see if Commons Lang's StringEscapeUtils could help you out. It has methods for HTML, XML and Java and corrects issues with special characters in strings. http://jakarta.apache.org/commons/lang/api/org/apache/commons/lang/StringEscapeUtils.html Hope this helps. Ben http://www.benwilcock.net