You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Vernon _ <vw...@hotmail.com> on 2007/03/16 19:06:42 UTC
Non-Latin Character Display
I have several Java web applications on Tomcat where non-Latin characters
function properly with only one exception. Non-Latin characters, Chinese in
this case, can be displayed properly thorough the JSTL message tag. The
related configuration are followings:
HTML:
JSP: <%@ page contentType="text/html;charset=UTF-8" language="java" %>
The applications can take Chinese character inputs correctly with a filter
of converting request character encoding to "UTF-8".
The only problem is that Chinese characters don't displayed properly when
they are directly typied on a JSP file. I have set the Eclipse file text
encoding to utf-8 and the characters are shown correctly in the IDE.
I believe that is a TC configuration related issue. After having "set
JAVA_OPTS= -Dfile.encoding=UTF-8" in the catalina.bat file, nothing has
changed.
How to solve this problem?
Thanks in advance.
_________________________________________________________________
Exercise your brain! Try Flexicon.
http://games.msn.com/en/flexicon/default.htm?icid=flexicon_hmemailtaglinemarch07
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Non-Latin Character Display
Posted by Vernon _ <vw...@hotmail.com>.
> > As I mentioned in my post, I already have the JSP page set as>
> > HTML: <meta http-equiv="Content-Type" content="text/html; charset=utf-8"
>/>
> > JSP: <%@ page contentType="text/html;charset=UTF-8" language="java" %>
>Mark was suggesting that you set the request encoding, not the response
>encoding.
The above is character set setting which is different from character
encoding. They are two different things.
In my original post, I already mentioned that I have converted the request
character encoding to utf-8.
> > I use a MVC framework. So, I am not sure anywhere using GET.
>Uhh.... right. I'm sure you use GET requests sometimes. Better set it in
.the connector. Honestly, the client should be reporting the request
>encoding, and you should be honoring it.
I can't see how this connect with the issue.
> > I have this issue for ages. I haven't been able to resolve. I have to
> > move long text into a message property file to go around this problem.
>Localized text should probably be in a separate file, anyway.
I don't know whether you understand the background or not. I was talking
about something in between two i18n approaches. When one is not working, I
have to use the other one.
>How are you typing those characters into your java source files? If you
>are using a source file encoding other than the default encoding on your
>system, you might have to tell the JSP compiler what encoding the files
>are in. You can't go wrong using \uWXYZ instead of native characters.
I typed the characters into a JSP file directly as I said in my original
post. I also try put a unicode in JSP file as what it is in a message
property file. The unicdoe shows up as what it is.
I believe the problem is laid in the process of either JSP file translation
or/and servlet compiling. That is why I took a shot on the file encoding of
Java option. It doesn't work, however.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFF+32M9CaO5/Lv0PARAkMrAJ9/cfgcX2drWxcFLAUUGTwgOc5bygCfYwp8
6NszrV4jEM2cVQqFiyH+b6o=
=iC5l
-----END PGP SIGNATURE-----
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
_________________________________________________________________
Get a FREE Web site, company branded e-mail and more from Microsoft Office
Live! http://clk.atdmt.com/MRT/go/mcrssaub0050001411mrt/direct/01/
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Non-Latin Character Display
Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Vernon,
Vernon _ wrote:
> As I mentioned in my post, I already have the JSP page set as
>
> HTML: <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
> JSP: <%@ page contentType="text/html;charset=UTF-8" language="java" %>
Mark was suggesting that you set the request encoding, not the response
encoding.
> I use a MVC framework. So, I am not sure anywhere using GET.
Uhh.... right. I'm sure you use GET requests sometimes. Better set it in
the connector. Honestly, the client should be reporting the request
encoding, and you should be honoring it.
> I have this issue for ages. I haven't been able to resolve. I have to
> move long text into a message property file to go around this problem.
Localized text should probably be in a separate file, anyway.
How are you typing those characters into your java source files? If you
are using a source file encoding other than the default encoding on your
system, you might have to tell the JSP compiler what encoding the files
are in. You can't go wrong using \uWXYZ instead of native characters.
- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFF+32M9CaO5/Lv0PARAkMrAJ9/cfgcX2drWxcFLAUUGTwgOc5bygCfYwp8
6NszrV4jEM2cVQqFiyH+b6o=
=iC5l
-----END PGP SIGNATURE-----
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Non-Latin Character Display
Posted by Vernon _ <vw...@hotmail.com>.
Thanks, Mark.
As I mentioned in my post, I already have the JSP page set as
HTML: <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
JSP: <%@ page contentType="text/html;charset=UTF-8" language="java" %>
I use a MVC framework. So, I am not sure anywhere using GET.
I have this issue for ages. I haven't been able to resolve. I have to move
long text into a message property file to go around this problem.
----Original Message Follows----
From: Mark Thomas <ma...@apache.org>
Reply-To: "Tomcat Users List" <us...@tomcat.apache.org>
To: Tomcat Users List <us...@tomcat.apache.org>
Subject: Re: Non-Latin Character Display
Date: Fri, 16 Mar 2007 21:17:37 -0400
Vernon _ wrote:
> I believe that is a TC configuration related issue. After having "set
> JAVA_OPTS= -Dfile.encoding=UTF-8"
There is no need to do this. This setting is read only on some JVMs.
Try the following. If you use GET, you'll need to set the encoding in
the connector as well.
<%@ page contentType="text/html; charset=UTF-8" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Character encoding test page</title>
</head>
<body>
<p>Data posted to this form was:
<%
request.setCharacterEncoding("UTF-8");
out.print(request.getParameter("mydata"));
%>
</p>
<form method="post" action="index.jsp">
<input type="text" name="mydata">
<input type="submit" value="Submit" />
<input type="reset" value="Reset" />
</form>
</body>
</html>
HTH,
Mark
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
_________________________________________________________________
Watch free concerts with Pink, Rod Stewart, Oasis and more. Visit MSN
Presents today.
http://music.msn.com/presents?icid=ncmsnpresentstagline&ocid=T002MSN03A07001
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Non-Latin Character Display
Posted by Mark Thomas <ma...@apache.org>.
Vernon _ wrote:
> I believe that is a TC configuration related issue. After having "set
> JAVA_OPTS= -Dfile.encoding=UTF-8"
There is no need to do this. This setting is read only on some JVMs.
Try the following. If you use GET, you'll need to set the encoding in
the connector as well.
<%@ page contentType="text/html; charset=UTF-8" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Character encoding test page</title>
</head>
<body>
<p>Data posted to this form was:
<%
request.setCharacterEncoding("UTF-8");
out.print(request.getParameter("mydata"));
%>
</p>
<form method="post" action="index.jsp">
<input type="text" name="mydata">
<input type="submit" value="Submit" />
<input type="reset" value="Reset" />
</form>
</body>
</html>
HTH,
Mark
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org