You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Sibi Joseph <si...@bigfoot.com> on 2001/08/01 18:09:54 UTC

charector encoding Problem while running servlet in tomcat

hi all

I have a servlet which outputs some chinese content to the browser. The webserver i used is Tomcat3.2.3. 

if i try browsing chinese sites with chinese char encoding on a english version of windows 2000 the pages comes well without specifying any encoding. 

When i used the same servlet in the Chinese Version of windows 2000, i had to set the characterset in the servletresponse (ie. hsResponse.setContentType "text/plain;charset=gb2312") to display the page correctly in the browser. 


If i specify the encoding scheme like above pages (both  chinese and english) are displayed properly in windows 2000 chinese version but chinese pages will not display properly in the english version of windows 2000. 

There was no problems in displaying pages with english content in both versions of windows (both when the encoding is specified and when it is not).

Now my question is

1) why does this happen?

2) Is there any way of getting the default encoding of a machine and set the servlets encoding scheme accordingly. 


NOTE:

The default encoding scheme in english version of windows 2000 was found to be Cp1252 and GBK in Chinese version


thanks in advance

sibi