Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Help required in implementing internationalization in JSP  RSS feed

 
Moin Shariff
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am using JSP on weblogic 6. I am trying to implement localization in JSP
to display locale specific text in the HMTL page rendered as well as for the
data obtained from the database.
For rendering locale-specific labels in the HTML page I have fetched the
text from resource bundles and added the <%@ page contentType="text/html;
charset=UTF-8" %> tag to the JSP. With this I am able to view the different
characters in different languages properly. But the data stored in the
database as Unicode characters (eg Japanese characters) when fetched and
displayed show junk.
For displaying data retrieved from the database correctly, the <%@ page
contentType="text/html; charset=UTF-8" %> tag has to be removed from the JSP
code and the browser (IE 5.0) encoding needs to be set as UTF-8 but then the
label fetched from property files are displayed as junk.
To sum it up, if I have the browser settings then labels fetched from
property files as displayed as junk.
and if I have <%@ page contentType="text/html; charset=UTF-8" %> set in the
JSP then data fetched from the data base is displayed as junk
I have my resource bundle file defined as follows:
web_jp_JP.properties
namekey=\u4e00 \u4e98
Does any one have any idea how to display both the data correctly.
Thanks in advance.
Regards,
Moin
 
Tim Holloway
Bartender
Posts: 18662
71
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To start with, Japanese needs a 16-bit character encoding. UTF-8 isn't wide enough.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!