On Wed, 5 Nov 2003, Adam Hardy wrote:

>- it lies with the character set interpretation in the HTML output from 
>the database and files - which files? I'm not familiar with file reading 
>  or whether you have to specify a character set.
Because of the "timing aspect" (next paragraph), I am sure it's nothing to 
do with settings concerning files or databases.

>- it occurs after random time intervals after starting tomcat. It 
>doesn't ever go away again does it?
Exaclty.
Although I could imagine an "event" not being exactly "random" might 
"switch" the behaviour.

>- the problem is overcome currently by restarting tomcat. This narrows 
>it down to Java or Tomcat basically. So you can forget the OS or the 
>database.
Yes, exactly my thought.

>- you manually encode umlauted letters into HTML code. I presume you 
>have a filter with a big switch case construct that parses your output 
>strings. Perhaps you should log the output of the ASCII value of the 
>umlauted letters, to see what you are really getting instead of what you 
>should be getting.
Good idea, i will write a test app which replaces unknwon characters 
with something like '_'+ASCII code+'_' instead of a space._

What I have forgotten to test out so far is, if all applications share 
the problem once it started. But I believe so.

>Where does the filter operate in your app? Obviously you have already 
>fetched your output string from either JDBC or from a file at the point 
>when you apply the filter. It is unlikely that both JDBC and the 
>file-reading processes always go wrong simulataneously. That is the case 
>though?
Yes.

The operation goes like this:
Read text files ...

  StringBuffer sb=new StringBuffer();
  BufferedReader reader=new BufferedReader(new FileReader(pathToFile));
  String nextLine=reader.readLine();
  while (nextLine != null)
  { sb.append(nextLine).append("\n");
    nextLine=reader.readLine(); }

... or database queries ...

  String = resulset.getString(colname);

... then put it through a loop including ...

  switch (string.charAt(i))
  { ...
    '�' : stringbuffer.append('ä'); break;
    ...
    default: stringbuffer.append(string.charAt(i));
  }

... finally print like this ....

  writer=new PrintWriter(resp.getOutputStream());
  writer.write(string);

The point the problem occurs (or at least shows up) is that the
switch statement walks the default branch for e.g. '�'.

So far thanks for the clearer formulation of the problem ;->>

kr

Christoph Lechleitner

Gesch�ftsf�hrung und Technik

------------------------------------------------------------------------
IBCL - Informatik-B�ro Dipl.-Ing. C. Lechleitner
Defreggerstr. 24, A-6020 Innsbruck, http://www.ibcl.at/
Tel.: +43 512 390717, Fax: +43 512 390787, Mobil: +43 699 12353479
------------------------------------------------------------------------

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to