You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Fred Whipple <fw...@imagineis.com> on 2003/08/11 02:00:50 UTC

Japanese Characters in JSP's

Hi All,

I'm having a bit of trouble with getting JSP's with Japanese characters
within them.  I'm working with a Windows XP system with JDK 1.4.2 and Tomcat
4.1.24.  The problem seems persistent, though, on RH Linux with JDK 1.4.1_03
as well.  I have no problem with Russian, Arabic, Hebrew, and other
non-Latin-1 character sets, just Japanese (so far).

More confusing, my test file is a very simple HTML document that Tomcat
services properly when I'm simply calling it as an HTML file, such as:

    http://localhost:8080/testfile.html

All I do is rename it to testfile.jsp, and it comes out all garbled.  I've
done the same test with a myriad of HTML files with various character sets
including cp1251, iso8859-5, etc.  Everything works fine except for
Japanese -- I believe my file uses Shift_JIS.  I don't have test files for
other multi-byte character sets so I've no idea if it's exclusive to
Japanese or if, for example, Chinese would not work either.

I've also tried adding response.setLocale (new java.util.Locale ("ja")) to
the top of the page; it made no difference.  I've also tried reading
everything I could find, and I'm empty handed.  This seems like it shouldn't
be quite as difficult as it is.

TIA!

    -Fred


Re: Japanese Characters in JSP's

Posted by Bill Barker <wb...@wilshire.com>.
I don't know why cp1251 et. al. work (probably they are single-byte
encodings, and shift_jis is multi-byte).

However, try adding:
 <%@page contentType="text/html; charset=shift_jis" %> to your page.  This
will tell Tomcat that the Writer should use "shift_jis" as it's encoding.
Since you can see the page as a ".html" file, you shouldn't need <%@page
pageEncoding="shift_jis" %>, but if you ever save the file as "shift_jis",
then you will need this directive as well.

"Fred Whipple" <fw...@imagineis.com> wrote in message
news:000001c35fb8$e60208a0$5100a8c0@jadzia...
> Thank you, Punam, for the suggestion -- However this is already
> specified both in the HTML file, and my browser is setup and capable of
> viewing x-sjis.  This is illustrated by the fact that the exact same
> file works perfectly under Tomcat so long as its file extension is .html
> and not .jsp.  Only when Tomcat tries to compile the file into a Servlet
> does it give me any trouble.
>
>     -Fred
>
> > Hi Fred,
> >
> > In the html header u will have to set the char set as SHIFT
> > JIS. And in the
> > browser SHIFT JIS should be set.
> >
> >
> > Regards,
> > Punam




---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: Japanese Characters in JSP's

Posted by Bill Barker <wb...@wilshire.com>.
I don't know why cp1251 et. al. work (probably they are single-byte
encodings, and shift_jis is multi-byte).

However, try adding:
 <%@page contentType="text/html; charset=shift_jis" %> to your page.  This
will tell Tomcat that the Writer should use "shift_jis" as it's encoding.
Since you can see the page as a ".html" file, you shouldn't need <%@page
pageEncoding="shift_jis" %>, but if you ever save the file as "shift_jis",
then you will need this directive as well.

"Fred Whipple" <fw...@imagineis.com> wrote in message
news:000001c35fb8$e60208a0$5100a8c0@jadzia...
> Thank you, Punam, for the suggestion -- However this is already
> specified both in the HTML file, and my browser is setup and capable of
> viewing x-sjis.  This is illustrated by the fact that the exact same
> file works perfectly under Tomcat so long as its file extension is .html
> and not .jsp.  Only when Tomcat tries to compile the file into a Servlet
> does it give me any trouble.
>
>     -Fred
>
> > Hi Fred,
> >
> > In the html header u will have to set the char set as SHIFT
> > JIS. And in the
> > browser SHIFT JIS should be set.
> >
> >
> > Regards,
> > Punam




RE: Japanese Characters in JSP's

Posted by Punam Mutha <pm...@talentbeat.com>.
Hi Fred,

Then you must try the -encoding option of java.exe in configuration file of
tomcat.
Also you  can try setting the encoding type to ISO 8859 1.

Regards,
Punam


-----Original Message-----
From: Fred Whipple [mailto:fwhipple@imagineis.com]
Sent: Sunday, August 10, 2003 11:30 PM
To: 'Tomcat Users List'
Subject: RE: Japanese Characters in JSP's


Thank you, Punam, for the suggestion -- However this is already
specified both in the HTML file, and my browser is setup and capable of
viewing x-sjis.  This is illustrated by the fact that the exact same
file works perfectly under Tomcat so long as its file extension is .html
and not .jsp.  Only when Tomcat tries to compile the file into a Servlet
does it give me any trouble.

    -Fred

> Hi Fred,
>
> In the html header u will have to set the char set as SHIFT
> JIS. And in the
> browser SHIFT JIS should be set.
>
>
> Regards,
> Punam


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


RE: Japanese Characters in JSP's

Posted by Punam Mutha <pm...@talentbeat.com>.
Hi Fred,

Then you must try the -encoding option of java.exe in configuration file of
tomcat.
Also you  can try setting the encoding type to ISO 8859 1.

Regards,
Punam


-----Original Message-----
From: Fred Whipple [mailto:fwhipple@imagineis.com]
Sent: Sunday, August 10, 2003 11:30 PM
To: 'Tomcat Users List'
Subject: RE: Japanese Characters in JSP's


Thank you, Punam, for the suggestion -- However this is already
specified both in the HTML file, and my browser is setup and capable of
viewing x-sjis.  This is illustrated by the fact that the exact same
file works perfectly under Tomcat so long as its file extension is .html
and not .jsp.  Only when Tomcat tries to compile the file into a Servlet
does it give me any trouble.

    -Fred

> Hi Fred,
>
> In the html header u will have to set the char set as SHIFT
> JIS. And in the
> browser SHIFT JIS should be set.
>
>
> Regards,
> Punam


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org



RE: Japanese Characters in JSP's

Posted by Fred Whipple <fw...@imagineis.com>.
Thank you, Punam, for the suggestion -- However this is already
specified both in the HTML file, and my browser is setup and capable of
viewing x-sjis.  This is illustrated by the fact that the exact same
file works perfectly under Tomcat so long as its file extension is .html
and not .jsp.  Only when Tomcat tries to compile the file into a Servlet
does it give me any trouble.

    -Fred

> Hi Fred,
> 
> In the html header u will have to set the char set as SHIFT 
> JIS. And in the
> browser SHIFT JIS should be set.
> 
> 
> Regards,
> Punam


RE: Japanese Characters in JSP's

Posted by Fred Whipple <fw...@imagineis.com>.
Thank you, Punam, for the suggestion -- However this is already
specified both in the HTML file, and my browser is setup and capable of
viewing x-sjis.  This is illustrated by the fact that the exact same
file works perfectly under Tomcat so long as its file extension is .html
and not .jsp.  Only when Tomcat tries to compile the file into a Servlet
does it give me any trouble.

    -Fred

> Hi Fred,
> 
> In the html header u will have to set the char set as SHIFT 
> JIS. And in the
> browser SHIFT JIS should be set.
> 
> 
> Regards,
> Punam


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


RE: Japanese Characters in JSP's

Posted by Punam Mutha <pm...@talentbeat.com>.
Hi Fred,

In the html header u will have to set the char set as SHIFT JIS. And in the
browser SHIFT JIS should be set.


Regards,
Punam


-----Original Message-----
From: Fred Whipple [mailto:fwhipple@imagineis.com]
Sent: Sunday, August 10, 2003 8:01 PM
To: tomcat-user@jakarta.apache.org
Subject: Japanese Characters in JSP's


Hi All,

I'm having a bit of trouble with getting JSP's with Japanese characters
within them.  I'm working with a Windows XP system with JDK 1.4.2 and Tomcat
4.1.24.  The problem seems persistent, though, on RH Linux with JDK 1.4.1_03
as well.  I have no problem with Russian, Arabic, Hebrew, and other
non-Latin-1 character sets, just Japanese (so far).

More confusing, my test file is a very simple HTML document that Tomcat
services properly when I'm simply calling it as an HTML file, such as:

    http://localhost:8080/testfile.html

All I do is rename it to testfile.jsp, and it comes out all garbled.  I've
done the same test with a myriad of HTML files with various character sets
including cp1251, iso8859-5, etc.  Everything works fine except for
Japanese -- I believe my file uses Shift_JIS.  I don't have test files for
other multi-byte character sets so I've no idea if it's exclusive to
Japanese or if, for example, Chinese would not work either.

I've also tried adding response.setLocale (new java.util.Locale ("ja")) to
the top of the page; it made no difference.  I've also tried reading
everything I could find, and I'm empty handed.  This seems like it shouldn't
be quite as difficult as it is.

TIA!

    -Fred


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


RE: Japanese Characters in JSP's

Posted by Punam Mutha <pm...@talentbeat.com>.
Hi Fred,

In the html header u will have to set the char set as SHIFT JIS. And in the
browser SHIFT JIS should be set.


Regards,
Punam


-----Original Message-----
From: Fred Whipple [mailto:fwhipple@imagineis.com]
Sent: Sunday, August 10, 2003 8:01 PM
To: tomcat-user@jakarta.apache.org
Subject: Japanese Characters in JSP's


Hi All,

I'm having a bit of trouble with getting JSP's with Japanese characters
within them.  I'm working with a Windows XP system with JDK 1.4.2 and Tomcat
4.1.24.  The problem seems persistent, though, on RH Linux with JDK 1.4.1_03
as well.  I have no problem with Russian, Arabic, Hebrew, and other
non-Latin-1 character sets, just Japanese (so far).

More confusing, my test file is a very simple HTML document that Tomcat
services properly when I'm simply calling it as an HTML file, such as:

    http://localhost:8080/testfile.html

All I do is rename it to testfile.jsp, and it comes out all garbled.  I've
done the same test with a myriad of HTML files with various character sets
including cp1251, iso8859-5, etc.  Everything works fine except for
Japanese -- I believe my file uses Shift_JIS.  I don't have test files for
other multi-byte character sets so I've no idea if it's exclusive to
Japanese or if, for example, Chinese would not work either.

I've also tried adding response.setLocale (new java.util.Locale ("ja")) to
the top of the page; it made no difference.  I've also tried reading
everything I could find, and I'm empty handed.  This seems like it shouldn't
be quite as difficult as it is.

TIA!

    -Fred


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org