tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Yair Zohar <y...@ard.huji.ac.il>
Subject Re: A Hebrew Problem
Date Wed, 17 Sep 2003 12:12:58 GMT
I have got to a solution:

It might be a private case but it may help others.

I'm reading the html with A BufferedReader that is running over a
AsciiFileReader which is using FileInputStream.

The idea is to read the file byte by byte casting it to char in a char 
array not before moving from ascii to unicode.

while (not end of html)
int readInt = input.read();

//moving from ascii to unicode
// be aware ascii hebrew can occur in different sets (224 - / 128 - )

if (readInt>=224 & readInt<=250) readInt = readInt -224 +1488

//casting

charArray[i] = (char)readInt;

}

it seems charset=windows-1255 displays hebrew for codes from 1488

I understood it after running this loop in a jsp page:

<% for (int i=0; i<65535; i++) { %>
     <%=i %> &nbsp; <%=(char)i %>
<%}%>

Thanks to all who directed me to the solution.





Bodycombe, Andrew wrote:
> I suggest setting the file.encoding system property.
> 
> export CATALINA_OPTS="-Dfile.encoding=utf-8"
> Then restart tomcat.
> 
> I once had a similar problem with German umlaute characters and this seemed
> to fix it.
> 
> Andy
> 
> -----Original Message-----
> From: Yair Zohar [mailto:yair@ard.huji.ac.il] 
> Sent: 17 September 2003 10:33
> To: Tomcat Users List
> Subject: Re: A Hebrew Problem
> 
> 
> After some investigation I'll try to refrase and improve my problem 
> description:
> 
> My Goal: including a hebrew html inside a jsp page.
> 
> The Problem: hebrew is viewed by browser as question marks (no matter 
> charset).
> 
> Some details from my investigation:
> 
> When I request the hebrew html directly (not included in a jsp but as 
> the request target itself) I see it right (charset=windows-1255).
> 
> When writing hebrew (same charset) in the same jsp page (that has the 
> include action) I see it right (but the included html is still ????).
> 
> To be sure it's not the 'include' action (<jsp:include 
> page="relativePath/fileName" flush="true" />) fault, I replaced it by a 
> function that returns the included page as a string and ensures it's 
> read in ascii:
> 
> <%= pageExecuter.readHtml() %>
> 
> when this didn't help, I wanted to be sure my function is returning the 
> jsp page an ascii string, I wrote this in the jsp page:
> 
> //moving the html string to a char array.
> <%char [] c =  pageExecuter.readHtml().toCharArray();
> 
>    for (int i=0; i<c.length; i++){%>
> 
> //displaying 'character code' 'character'
>      <%= (int)c[i] %>;&nbsp; <%= c[i] %><br>
> 
> <% } %>
> 
> in that way I can see in the browser each character's code and the 
> character itself.
> I've got ascii codes, but near the hebrew ascii codes there were '?'
> 
> (I'm aware of the different hebrew ascii sets exists I tried both 
> 224-250 , 128 - 154 )
> 
> My conclusion:
> Tomcat doesn't send the browser a response with ascii code but with some 
> other code.
> 
> Any Idea ?
> 
> Thanks for your efforts.
> 
> 
> 
> Anton Tagunov wrote:
> 
>>Hello Yair!
>>
>>YZ> I have this hebrew problem:
>>YZ> I'm trying to include a html in a jsp page:
>>YZ> <jsp:include page="relativePath/fileName" flush="true" />
>>YZ> When it comes to a hebrew html the browser displays question marks 
>>YZ> instead of hebrew (no matter what charset do I choose in the browser).
>>
>>YZ> The same html is viewed nicely when I get it directly as a file
>>
>>
>>1)
>>
>>Do I get you right that you have
>>
>>  web-app-root/some/a.jsp
>>  web-app-root/other/b.html
>>
>>and when you do
>>
>>  http://www.myserver.some-domain/my-web-app/other/b.html
>>
>>you get something real, not question marks?
>>
>>2)
>>
>>I vagually recall some talks about this being a JSP spec limitation
>>on the list, but I did not delve into the topic then.
>>
>>I also recall that the it was mentioned then that the new
>>spec-compliant but unconvinient behavior has been introduced
>>recently.
>>
>>Anyone, any tips?
>>
>>(nagoya.apache.org eyebrowse search is not too much responsive when
>>searching tomcat-dev, and tomcat-user is not indexed at all :-(
>>
>>YZ> System: RH9 with tomcat-4.1.18, mod_jk-2.0.43, apache-2.0.44,
> 
> j2sdk1.4.2
> 
>>YZ> It all works fine on an old server: RH7.1 tomcat-4.0.4 apache-1.3 
>>YZ> mysql-connector-java-3.0.7 j2sdk1.4.0_03
>>
>>Anton
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>>For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>>
>>
>>
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> 
> 
> 


Mime
View raw message