~ chicken-core (chicken-5) 7c5e1b948fe5ffdb1f806eebc626ade06cd15b58


commit 7c5e1b948fe5ffdb1f806eebc626ade06cd15b58
Author:     Florian Zumbiehl <florz@florz.de>
AuthorDate: Tue Mar 5 18:48:44 2013 +0100
Commit:     Moritz Heidkamp <moritz@twoticketsplease.de>
CommitDate: Sun Mar 10 12:57:16 2013 +0100

    write: escape DEL character in strings, encode BEL as \a
    
    Encode DEL (ASCII character 127) in strings as \x7f instead of as literal DEL
    in write.  Also encode BEL (ASCII character 7) as \a instead of \x07, for
    consistency.
    
    Signed-off-by: Peter Bex <peter.bex@xs4all.nl>

diff --git a/library.scm b/library.scm
index f11a4ee9..5a2862e4 100644
--- a/library.scm
+++ b/library.scm
@@ -3310,15 +3310,17 @@ EOF
 			      ((34) (outstr port "\\\""))
 			      ((92) (outstr port "\\\\"))
 			      (else
-			       (cond ((fx< chr 32)
+			       (cond ((or (fx< chr 32)
+					  (fx= chr 127))
 				      (outchr port #\\)
 				      (case chr
+                                        ((7) (outchr port #\a))
+					((8) (outchr port #\b))
 					((9) (outchr port #\t))
 					((10) (outchr port #\n))
-					((13) (outchr port #\r))
 					((11) (outchr port #\v))
 					((12) (outchr port #\f))
-					((8) (outchr port #\b))
+					((13) (outchr port #\r))
 					(else
 					 (outchr port #\x)
 					 (when (fx< chr 16) (outchr port #\0))
Trap