Search This Blog

Saturday, March 27, 2010

How to display special characters in HTML using Java?

To make special characters and accented letters show up on your web pages, use special set of codes called character entities, which you insert into your HTML code and which your browser will display as the corresponding symbols or characters you want. You can achieve this in java using apachie's String Escape Utils function. It provides functions to encode the special characters from java. The method is given below for your reference:


Include commons-lang-2.4.jar jar file in your classpath.

Sometimes we need to display special characters in encoded format itself, you can use this class either way, it provides unescape functions for special characters to display its code in your web page itself.

This class provides escape util functions for XML, Javascript, CSV also.

No comments:

Post a Comment