tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Deacon Marcus" <deacon_mar...@wwtech.pl>
Subject RE: Problem with page encoding for ISO-8859-2
Date Mon, 20 Aug 2001 19:13:23 GMT
Hi,

> From: Marcin Jaskuła [mailto:jaskula@expro.pl]
> Sent: Monday, August 20, 2001 8:39 PM
>
> Hi,
>
> I have change my JSP server form JServ to Tomcat (v. 3.2.3-1) recently and
> found several problems with page encoding.
> I have looked into the archive and found a lot of mails about the problem
> but no simple solutions.
>
> The problems are:
>
> 1. Compilation problem:
> I wrote some simple jsp page, which consists of some polish character:
>
> <%@ page contentType="text/html; charset=iso-8859-2" %>

Most of the time I use:
<%@ page buffer="16kb" contentType="text/html; charset=iso-8859-2"
pageEncoding="iso-8859-2" autoFlush="false" %>
As far as I know it's the "pageEncoding" that matters, and "contentType" is
only used for specifing what is send in "Content-type:" HTTP header. So, in
non-english page it makes no sense to use only one, you have to set both.

> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
I'm not 100% positive on that one, but I think this line should be the first
line in file, and it won't be - if you have end of line after a directive,
you get empty line and this is send as second line.

> <html>
> <head>

> <meta http-equiv="content-type" content="text/html; charset=iso-8859-2">
Redundant - that's what was set in Page directive.

> </head>
> <body>
> ą
> </body>
> </html>
>
> The server crashes with error 500:
>
> Internal Servlet Error:
>
> org.apache.jasper.JasperException: Unable to compile class for JSP
> Found 1 semantic error compiling "_0002fa_0002ejspa_jsp_0.java":
>
>     56.                 out.write("\n\n\n\n\n\n\n\u00-$\u00)%
> <----------\n\n\n");
>
> *** Error: The value of this "String" literal is invalid. Perhaps it
> contains a bad escape sequence?
>
> If I change "ą" to "a" it works !
> In my opinion the characters are translated to the Unicode in wrong way.
>
> 2. I cannot get proper values from the forms. When I use
> request.getParameter() method I get different characters then I write into
> form's fields (returned characters depend on the "page contentType" value
> but always are wrong).
>
> 3. When I try to print some data from a database I get wrong characters in
> the output !
>
>
> The best solution is to turn off all encoding of IO streams and before
> compilation of the jsp page. Maybe somebody has done it already
> or there is
> some other method to solve the problems.
>
> Bye
> 	Marcin
>
>
>
>

Greetings, deacon Marcus




Mime
View raw message