There are several solutions with translating and encoding in international charsets.
1: Instead of ServletResponse.getWriter(), you can use something like that:
 
PrintWriter out=new PrintWriter(response.getOutputStream());
 
or (using getWriter with selected encoding):
 
response.setContentType("text/html; charset=iso-8859-2");
PrintWriter out=response.getWriter();
 
2: Try not to read one byte each time but open input as f.ex. BufferedReader(FileReader(filename)) and read one line each time. If you can't - read a char not a byte.
 
3: If you are using a charset for displaying pages other than your system charset, you can do as I did:
I'm working on system with encoding Cp1250 but my web pages are in ISO-8859-2. All my text files and database string fields are in Cp1250 and without any complications I send data directly to servlet output.
This is my solution:
 
response.setContentType("text/html; charset=iso-8859-2");
PrintWriter out = new PrintWriter(new OutputStreamWriter(response.getOutputStream(),"ISO8859_2"));
 
One more tip: I use JWS 1.1.3 for Win, but it not allow to send SQL queries which contain Polish signs as �,�,�... I replaced the 'server_root/jre/bin/jdbcodbc.dll' file with similar one from JBuilder2. It works !!!
 
Rafal

Reply via email to