Fixing an issue with other whitespace besides newline (e.g. tab) so that those will also get replaced with spaces for console display purposes