If Eclipse will not interact, I would suggest replacing null characters with spaces before printing:
System.out.println(s.replace('\u0000', ' '));
If you need to do this in many places, here's a hack to filter them from System.out itself:
import java.io.*;
...
System.setOut(new PrintStream(new FilterOutputStream(
new FileOutputStream(FileDescriptor.out)) {
public void write(int b) throws IOException {
if (b == '\u0000') b = ' ';
super.write(b);
}
}));
Then you can usually call the System.out methods with all the data passing through the filter.
Boann source
share