From 20a768b4d75f912baadcd532ca0edd4f85c80625 Mon Sep 17 00:00:00 2001 From: Jeff Bezanson Date: Sat, 19 Aug 2017 14:18:32 -0400 Subject: [PATCH] fix bug in printing the character #\x0 --- print.c | 5 ++++- tests/unittest.lsp | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/print.c b/print.c index 29b9e98..1b17bad 100644 --- a/print.c +++ b/print.c @@ -635,7 +635,10 @@ static void cvalue_printdata(ios_t *f, void *data, size_t len, value_t type, seq[nb] = '\0'; if (print_princ) { // TODO: better multibyte handling - outs(seq, f); + if (wc == 0) + ios_putc(0, f); + else + outs(seq, f); } else { outsn("#\\", f, 2); diff --git a/tests/unittest.lsp b/tests/unittest.lsp index f2eb90e..1046b7f 100644 --- a/tests/unittest.lsp +++ b/tests/unittest.lsp @@ -78,6 +78,7 @@ (assert (equal? (uint64 (double -123)) #uint64(0xffffffffffffff85))) (assert (equal? (string 'sym #byte(65) #wchar(945) "blah") "symA\u03B1blah")) +(assert (= (length (string #\x0)) 1)) (assert (> 9223372036854775808 9223372036854775807))