tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Wall <d.w...@computer.org>
Subject Re: Tomcat 7.0.19 character encoding issue with JSP
Date Thu, 01 Sep 2011 18:04:51 GMT
Thanks for the ideas, Mark, but it's still the same undesirable result.

On 9/1/2011 6:58 AM, Mark Thomas wrote:
> I suspect you need:
> <%@ page pageEncoding="UTF-8" %>
> at the start of your JSP.
>
> .java files are written using UTF-8 by default so if what you see there
> is wrong then the original .jsp file was read with the wrong encoding.

My JSP file that I write shows it correctly since changing my 
PrintWriter to set the stream to UTF-8.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ page pageEncoding="UTF-8" contentType="text/html; charset=UTF-8" 
session="true" isELIgnored="true" %>
<%@ taglib uri="http://open.esignforms.com/libdocsgen/taglib" 
prefix="esf" %>
...
<p>These have issues: ► Ŵ but these don&#39;t: &trade; &hArr; &diams;

&aacute; &para; &yen;</p>
...

But the generated .java files still shows:

out.write("<p>These have issues: â–º Å´ but these don&#39;t: &trade; 
&hArr; &diams; &aacute; &para; &yen;</p>\n");

I checked and the file mod timestamps are updated so I know these are 
newly created files when I run the generated JSP.  I noted that the 
compiler was looking for "UTF-8" (and not allowing "UTF8" or "utf-8" or 
other variants).

My only guess now is to know what's the file encoding used when the 
Tomcat compiler (Jasper?) READS my JSP file. Is it possible that it is 
messed up reading my UTF-8 encoded JSP file, even though it then writes 
the .java file with UTF-8 also?

I am running Windows 7, Tomcat 7.0.19, latest Java 6, and running this 
in Eclipse Helios Service Release 2.

Any other thoughts I can try?

Thanks,
David


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


Mime
View raw message