-
Handling Special Characters in JSP (2 messages)
- Posted by: Srinivas Reddy Bijjam
- Posted on: February 07 2007 12:19 EST
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 ReddyThreaded Messages (2)
- Re: Handling Special Characters in JSP by Jeryl Cook on February 09 2007 16:49 EST
- Try Commons Lang's StringEscapeUtils by Ben Wilcock on February 13 2007 07:54 EST
-
Re: Handling Special Characters in JSP[ Go to top ]
- Posted by: Jeryl Cook
- Posted on: February 09 2007 16:49 EST
- in response to Srinivas Reddy Bijjam
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. -
Try Commons Lang's StringEscapeUtils[ Go to top ]
- Posted by: Ben Wilcock
- Posted on: February 13 2007 07:54 EST
- in response to Srinivas Reddy Bijjam
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