I have two instances of Tomcat 3.2.2, one running under Windows NT, the
other running under Linux. The problem is identical in the two.
No matter what character set I use when saving my JSP files to disk, Tomcat
always assumes that they're in UTF8 format. When I activate "DEBUG" logging
for "jasper.log", the following entry always appears when compiling a class:
Compiling with: -encoding UTF8 ...
(the "..." refers to other command-line parameters, such as "-classpath").
This has some unfortunate side effects:
1./
If I save my file as UTF-16, no JSP tags are recognised are the resulting
file is supplied "as-is" to the browser. I've looked at the ".java" file
that Tomcat creates, and it creates lines such as :
out.write("ÿþ< % @ p a g e l a n g u a g e = \" j a v a \" % > \r\n
< % ! \r\n s t a t i c i n t h i t s = 0 ; \r\n % > \r\n < h t m
l > \r\n < h e a d > \r\n < t i t l e > J S P E x a m p l e < / t i t l
e > \r\n < / h e a d > \r\n < b o d y > \r\n \r\n < h 1 > J S P E x a
m p l e < / h 1 > \r\n \r\n < p > H i t c o u n t : < % = + + h i t
s % > � é x < / p > \r\n \r\n < / b o d y > \r\n < / h t m l >
");
2./
All accented characters are shown up as "é" or similar (instead of "�").
This has nothing to do with the <%@page contentType %> directive, as that's
handled correctly. It's the creation of the .java file which goes wrong.
Is this a known bug? Any workarounds? Never seemed to have this problem
running the same code under Tomcat 3.2.1...
-Chris