1
0
Fork 0

- prevented signalling error when an invalid byte sequence is met, when converting octects to string.

This commit is contained in:
cage 2022-02-16 17:43:22 +01:00
parent 970d222c4d
commit 39b0b6ae83
2 changed files with 3 additions and 3 deletions

View File

@ -52,13 +52,13 @@
0
(file-length stream))))
(defun slurp-file (filename &key (convert-to-string t))
(defun slurp-file (filename &key (convert-to-string t) (errorp nil))
"A simple way to slurp a file."
(with-open-file (stream filename :direction :input :element-type '(unsigned-byte 8))
(let ((seq (make-array (file-length stream) :element-type '(unsigned-byte 8))))
(read-sequence seq stream)
(if convert-to-string
(babel:octets-to-string seq)
(babel:octets-to-string seq :errorp errorp)
seq))))
(defun dump-sequence-to-file (seq file)

View File

@ -78,7 +78,7 @@
object)
(defmethod to-s ((object vector))
(coerce object 'string))
(babel:octets-to-string object :errorp nil))
(defmethod to-s ((object character))
(string object))