Now handles non-printable characters and will not output a spurious new-line if given a partial line.