Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / March 2007

Tip: Looking for answers? Try searching our database.

JSP Internationalization

Thread view: 
dschectman@yahoo.com - 07 Mar 2007 21:44 GMT
I am trying to setup a test for internationalizing JSP pages in
Japanese.  I have some sample strings that I converted in resource
files which I ran through native to ascii.

When I run the pages, I do not see any Japanese characters.  On the
screen I only see question marks.  I tried hardcoding the unicode
encoded strings.  I still get question marks.  What am I missing.

The application is running on iplanet app server 6.5 and iplanet web
server 6.0.
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1_04-b02)
Java HotSpot(TM) Client VM (build 1.3.1_04-b02, mixed mode)

Thanks for your input.

David

Here is the output
This is a test for Japanese: ??? ? ???

Here is the JSP source.
<%@ page import="java.util.ResourceBundle" %>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
</head>
<body>
This is a test for Japanese:
<%
ResourceBundle res = ResourceBundle.getBundle("MyResource");
%>
<%=res.getString("teststring"); %>
<%
tmp="\u6708"; //unicode encoded
%>
<%=tmp%>
<%
tmp="十二月";
%>
<%=tmp%>
</body>
</html>
ck - 07 Mar 2007 23:01 GMT
On Mar 8, 2:44 am, dschect...@yahoo.com wrote:
> I am trying to setup a test for internationalizing JSP pages in
> Japanese.  I have some sample strings that I converted in resource
[quoted text clipped - 39 lines]
> </body>
> </html>

save the resource file as utf8 format. If you save it as ascii char
set you would get question marks.

--
Ck
http://www.gfour.net
dschectman@yahoo.com - 08 Mar 2007 15:10 GMT
> On Mar 8, 2:44 am, dschect...@yahoo.com wrote:
>
[quoted text clipped - 49 lines]
>
> - Show quoted text -

The native resource file is saved as UTF 8.  When I run native2ascii I
specify utf-8 encodiing.  The ASCII equivaluents whether from the
compiled resource file or pasted into the JSP appear as question
marks.

David
mart - 20 Mar 2007 11:17 GMT
I had a similar problem with Greek characters.  The only thing that
fixed it for me was to make sure that my Oracle database was in the
correct character set, Oracle 9i did not use the standard UTF-8 unless
you set up the whole database at creation time with one obscure
character set.

Also had to put this in all my pages.
<%@ page language="java" contentType="text/html; charset=UTF-8"
   pageEncoding="UTF-8"%>

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

Absolutely all of them including in all the included JSP files.  That
fixed it for me.  In my experience it is normally the database that is
causing the problem.

Sorry if you know this already, best of luck
cheers
Martin

On Mar 8, 4:10 pm, dschect...@yahoo.com wrote:

> > On Mar 8, 2:44 am, dschect...@yahoo.com wrote:
>
[quoted text clipped - 41 lines]
> > > </body>
> > > </html>

> > save the resource file as utf8 format. If you save it as ascii char
> > set you would get question marks.
[quoted text clipped - 10 lines]
>
> David
dschectman@yahoo.com - 21 Mar 2007 16:32 GMT
> I had a similar problem with Greek characters.  The only thing that
> fixed it for me was to make sure that my Oracle database was in the
[quoted text clipped - 78 lines]
>
> > David

Thanks for all your responses.  We do have the meta tags and the JSP
page encoding on our pages.  Strings are displaying correctly from the
resource files.  The issue is due, in part, to the version of our
JDK.  The application server we use, iplanet 6.5, uses Java 1.3.1_04.
The URLEncoder and URLDecoder classes in this version of Java do not
support multiple encodings.  When the Unicode characters are passed
through these classes, the encoding is messed up.  Unfortunately, we
are not able to upgrade the application server or the JDK at this
time.  Can anyone point me to a URL encoder and decoder for this
version of Java that supports Unicode.  URL encoding for ASCII should
work as it does now.  Encoding Unicode characters should translate
them to %u format as in %u7523.
Oliver Wong - 14 Mar 2007 17:02 GMT
> I am trying to setup a test for internationalizing JSP pages in
> Japanese.  I have some sample strings that I converted in resource
[quoted text clipped - 3 lines]
> screen I only see question marks.  I tried hardcoding the unicode
> encoded strings.  I still get question marks.  What am I missing.

   I'm not sure whether this is a feasible solution for you, but whenever
I post Japanese text on my blog, I use HTML escape entities, e.g.
&#x305f;&#x307e;&#x3086;&#x3089; Of course, this makes text take up to 4
times more bandwidth (8 bytes instead of 2 per character), but it works
for me as I tend to post only very short snippets of Japanese, and I've
found this to be the most trouble-free (in the sense that the largest
range of audience is able to see the text without any fiddling) method.

   - Oliver


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.