[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Chicken-users] External representation of strings with non-printable ch
From: |
Thomas Chust |
Subject: |
[Chicken-users] External representation of strings with non-printable characters |
Date: |
Wed, 03 Aug 2005 19:44:57 +0200 |
User-agent: |
Mozilla Thunderbird 1.0.2 (Macintosh/20050317) |
Hello,
I just came across this slightly strange behaviour of CHICKEN on a terminal:
$ csi
______ __ __ __
| | |--.|__|.----.| |--.-----.-----.
| ---| || || __|| <| -__| |
|______|__|__||__||____||__|__|_____|__|__|
Version 2, Build 101 - macosx-unix-gnu-ppc - [ dload ]
(c)2000-2005 Felix L. Winkelmann
#;1> (define str (string #\nul #\x02 #\1))
#;2> (string->list str)
(#\nul #\x2 #\1)
#;3> str
"\\1"
#;4> (string->list "\\1")
(#\\ #\1)
#;5> (string->list "\x00\x021")
(#\nul #\x2 #\1)
Similar behaviour can also be seen if you apply string->symbol to the
above string and write the symbol.
Although writing all sorts of special characters to the output port as
themselves works fine for file ports, terminals may get confused by
this. I think it would be nicer to output characters <32 and >128 as
hexadecimal or octal escape sequences, at least on a terminal port.
cu,
Thomas Chust
- [Chicken-users] External representation of strings with non-printable characters,
Thomas Chust <=