From 9c97e6f630c6d6f5b3f4f6f7c35f1d66f1019255 Mon Sep 17 00:00:00 2001 From: Tim Bradshaw <tfb@cley.com> Date: Sat, 23 Oct 2021 12:19:57 +0100 Subject: [PATCH] read-stream-content-into-string element-type fix Default the element type of the string being created from the element type of the stream being read. This has two advantages: it will make things work for implementations which have a mode where the default string element type is a subtype of character, and it will also mean that if the stream's element type is a subtype of character you may get thinner strings. --- alexandria-1/io.lisp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/alexandria-1/io.lisp b/alexandria-1/io.lisp index 28bf5e6..28d744a 100644 --- a/alexandria-1/io.lisp +++ b/alexandria-1/io.lisp @@ -54,7 +54,8 @@ which is only sent to WITH-OPEN-FILE when it's not NIL." "Return the \"content\" of STREAM as a fresh string." (check-type buffer-size positive-integer) (let ((*print-pretty* nil)) - (with-output-to-string (datum) + (with-output-to-string (datum nil + :element-type (stream-element-type stream)) (let ((buffer (make-array buffer-size :element-type 'character))) (loop :for bytes-read = (read-sequence buffer stream) -- GitLab