You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Tõnu Põld <To...@andmevara.ee> on 2001/07/02 11:55:51 UTC

RE: ?lgi:RE: Character Encoding Problem

Just a thought about the <jsp:include... problem:
try to place the "<%@page contentType=" in each file you include?


When reading bytes from file with FileReader the default character encoding
is used.
I think you must specify your own encoding when reading the file.

The suns javadoc says about FileReader class:
"Convenience class for reading character files. The constructors of this
class assume that the default character encoding and the default byte-buffer
size are appropriate. To specify these values yourself, construct an
InputStreamReader on a FileInputStream. "

Tõnu

> -----Original Message-----
> From: atumer@tr.net [mailto:atumer@tr.net]
> Sent: Monday, July 02, 2001 11:16 AM
> To: tomcat-user@jakarta.apache.org
> Subject: ?lgi:RE: Character Encoding Problem
> 
> 
> > Kimden: Tõnu Põld <To...@andmevara.ee>
> > Tarih: 2001/07/02 Mon AM 10:48:10 GMT+03:00
> > Kime: "'tomcat-user@jakarta.apache.org'" 
> <to...@jakarta.apache.org>
> > Konu: RE: Character Encoding Problem
> > 
> > Hi,
> > 
> > You should compile the java classes with ISO-8859-9 encoding.
> > Look at the -encoding flag of the 'javac' compiler.
> > 
> > In compilation the 8-byte characters in strings are 
> converted to unicode
> > characters.
> > By default the encoding is probably ISO-8859-1.
> > 
> > Regards,
> > Tõnu
> > 
> 
> I tried, a few minutes ago, but the problem remains. I don't
> know the usage of -encoding parameter in detail but,
> I think it is related with the string constants in the 
> source files. The main problem is the encoding when I read
> a text file and show its contents in the jsp with something like,
> 
> <%= FileReader.readLine() %>
> 
> And as I mentioned, when I load a file and write it into 
> another file, the encoding is correct. The result of my 
> string manipulation functions are correct. The single, 
> devastating, problem occurs when I pass a string with 
> characters in ISO-8859-9, from a class to jsp.
> 
> Ah, <jsp:include also still is a problem .. :(
> 
> Himm .. It is a stupid thought but is it something to do with 
> dynamic strings vs. static strings. As far as I know when <%@ 
> include.. is used the file is statically included,
> at compile time, but <jsp:include.. may include the file 
> dynamically after compilation. Also the string constants in 
> jsp files are compiled, but strings read from files are
> read and generated in execution time .. Himmm .. I think I am 
> going paranoic :) ..
> 
> Thanks, anyway .. Has anyone encountered this kind of problem 
> before ??
> 
> Arif ..
>