diff --git a/src/gmnlm.c b/src/gmnlm.c
index a058caa10e6655aa6f516555717cd2c6df56759c..ff17c1a661ec9b95847b391e720964c4bab24e9d 100644
--- a/src/gmnlm.c
+++ b/src/gmnlm.c
@@ -1152,6 +1152,11 @@ }
if (n < 0) {
n = 0;
}
+ for (int i = 0; i < n; i++) {
+ if (iscntrl(buf[i]) && (buf[i] < '\t' || buf[i] > '\v')) {
+ buf[i] = '.';
+ }
+ }
ssize_t w = 0;
while (w < (ssize_t)n) {
ssize_t x = fwrite(&buf[w], 1, n - w, browser->tty);