tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nikola Milutinovic <Nikola.Milutino...@ev.co.yu>
Subject Re: Problem with iso-8859-2 charset
Date Thu, 03 Jan 2002 12:44:26 GMT
Maciej Ko³odziej wrote:

> Hi,
> 
> In Your mail sent Wednesday, January 02, 2002 I wrote:
> 
> MK> I'm  using  Tomcat 3.3 on Linux Debian unstable system. Everything was
> MK> fine  until  I made an upgrade of the distribution. Now all iso-8859-2
> MK> chars  are  returned  as  two-byte  values  (Unicode?),  and  I can see
> MK> question  marks  and  squares  instead of letters. Does anyone have an
> MK> idea what can it be? Configuration problem? Same jsp pages worked fine
> MK> before the upgrade.


To what version?


> I found some new interesting information about this behavior:
> 
> First,  in  case  described  above,  if I choose Encoding->UTF-8 in my
> browser everything looks  fine.
> That means, that Tomcat(?) converts chars from iso-8859-2 in .jsp file
> to  unicode on the server output. So setting the page charset to utf-8
> in <meta> should work.


So, Tomcat is just plain spitting it out. It is a bit strange that it should 
print it as UTF-8. My understanding is that, if not specified, Tomcat will use 
default JVM character encoding to convert the output. The default is, usually, 
ISO-8859-1.

This is usually derived from UNIX "locale" environment.


> Second,  I  found,  that if I use a <bean:message .../> tag to insert
> text  from  properties  file  and  the text contains polish characters
> entered  in  unicode  (like \u0105) then the encoding on the output is
> back iso-8859-2, so there is conversion, but in this case from Unicode
> to iso-8859-2 (browser is set to iso-8859-2).
> 
> So  the problem is partially solved, because I can choose one of these
> solutions  to get desirable result. But I'm just curious - what can be
> the cause of that?


Have you set JSP page output encoding properly? I found out that my troubles 
were caused by "misinterpreting" JSP specification - "pageEncoding" atribute 
doesn't do the job, I had to use "contentType" instead. So, something like this 
should work:

<%@ page
   info="Test page"
   contentType="text/html; charset=iso-8859-2"
%><%!
...
%><%
...
%><html>
<head>
<title>Test page</title>
<meta http-equiv="Content-Type" value="text/html; charset=iso-8859-2">
</head>

<body>
...
</body>
</html>

Nix.


--
To unsubscribe:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands: <mailto:tomcat-user-help@jakarta.apache.org>
Troubles with the list: <mailto:tomcat-user-owner@jakarta.apache.org>


Mime
View raw message