Clean non-printable chars from stdout instead of dropping the whole thin...

Fixes #7486