Below is procedure to show Chinese characters on JSP pages using property files in web application.
- Create new property file for Chinese language of extension _zh.properties like ABC_zh.properties.
- Open the newly created property file in UTF-8 enabled editor like notepad or Edit+.
- Put the relevant key values in Chinese language. Like. customer.number=客户号码
- After setting all key values in property file, save file as encoding as UTF-8.
- Use tool native2ascii from JDK bin directory to convert Chinese characters to Unicode using following command by ensuring the encoding to UTF-8.
- Convert native to ASCII using following command:
$JAVA_JOMEbin>native2ascii.exe -encoding UTF-8 ABC_zh.properties ABC_zh_1.properties
- Copy newly created ABC_zh_1.properties to original location of property files and renamed to ABC_zh.properties
- Add the following line in starting the weblogic server like
- Add following java options:
set JAVA_OPTIONS=%JAVA_OPTIONS% %JAVA_PROPERTIES% -Dwlw.iterativeDev=%iterativeDevFlag% -Dwlw.testConsole=%testConsoleFlag% - Dwlw.logErrorsToConsole=%logErrorsToConsoleFlag% -Dfile.encoding=UTF-8
- Add the content type as UTF-8 in displaying JSP pages by adding following line at start of JSP file.
- Thats It !!!