tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ivan Montoro <ivan_montoro_...@yahoo.es>
Subject JSP include directive and UTF-8 files in Tomcat 5
Date Sun, 04 Apr 2004 19:14:13 GMT
Hi everybody,

I've found that with the default installation of
Jakarta Tomcat 5.0.19, JSP include directive fails to
add UTF-8 files to the generated .java source file. If
you create a simple .jsp file with a <%@include
directive, and include an HTML file saved as UTF-8,
the resulting .java file contains the UTF-8
representation of the ISO-8859-1 characters.

I'm using the Unix "file" tool to see if the files
I have are UTF-8 or not, so that's clear. I've
tried the -Dfile.encoding=UTF-8 at setenv.sh and
javaEncoding property in web.xml with no result.

-------------------------------------------------
sample.jsp (UTF-8)
-------------------------------------------------
<%@ page contentType="text/html;charset=UTF-8" %>
<HTML><HEAD></HEAD><BODY>
hellô wórld!
<%@ include file="sample.html" %>
</BODY></HTML>
-------------------------------------------------
sample.html (UTF-8)
-------------------------------------------------
fóò bär
-------------------------------------------------
resulting file (sample_jsp.java at work/ folder)
-------------------------------------------------
[...]
      out.write("<HTML><HEAD></HEAD><BODY>\n");
      out.write("hellô wórld!\n");
      out.write("fóò bär\n");
      out.write("</BODY></HTML>\n");
[...]
-------------------------------------------------
output in the browser
-------------------------------------------------
hellô wórld! fóò bär
-------------------------------------------------
using "iconv -t ISO-8859-1" to convert .java file
-------------------------------------------------
      out.write("<HTML><HEAD></HEAD><BODY>\n");
      out.write("hell wrld!\n");
      out.write("fóò bär\n");
      out.write("</BODY></HTML>\n");
-------------------------------------------------

So, I believe that when you make a <%@include in
Tomcat 5, the file is opened and read in ISO-8859-1
encoding and then added to the .java source and
compiled. I'm right? Is there any way to tell Tomcat
to load files from <%@include in UTF-8?

Thanks!

Ivan

___________________________________________________
Yahoo! Messenger - Nueva versión GRATIS
Super Webcam, voz, caritas animadas, y más...
http://messenger.yahoo.es

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


Mime
View raw message