Recognize that line has already been decoded from UTF8 as a result of BufferedReader. There's no reason to encode it back to UTF8 only to decode it again. We can also cleanup that replaceAll stuff with a simple trim call.