FileWriter uses "the default character encoding", which seems like
asking to live in interesting times. The program assumes UTF-8 when
it reads the file, so it should obviously do the same when it writes
it back.
The problem was due to marketcheck using DataInputStream.readLine(),
which is a fundamentally broken function and has been deprecated since
Java 1.1. Strings in Java consist of Unicode characters, not bytes.