The trick is to get encodings right.
This is mistake #1. The InputStreamReader needs to know about the specific encoding it is getting -- pull it from the HTTP response headers or, slightly uglier, hardcode iso-8859-2. Check the javadoc API for the appropriate constructor.
And this is certainly a cardinal sin in internationalised
Java. You are using the write(int) method of OutputStream, which will just chop off the top 8 bits of your char and write out a byte. This basically ignores
any encoding that's being used and will only ever work properly for 7-bits ASCII stuff. What you need to do is use FileWriter instead of FileOutputStream; this will write Strings directly using your default encoding. Alternatively, if the default encoding won't do, simply wrap your FileOutputStream inside an OutputStreamWriter; you can use the latter's constructor to ask for any encoding that takes your fancy. As long as it is supported by your JRE, of course.
- Peter
[ October 11, 2003: Message edited by: Peter den Haan ]