[gambit-list] Character encoding and the repl

Atticus atticus0 at posteo.org
Fri May 29 14:12:40 EDT 2015


Hello,

First and formost thanks for developing and maintaining gambit.

As a beginner I'm a litte confused about the handling of the character
encoding in the repl. 

$ gsi -:d,t8,f8
$> "ü"
"\374"

$> (string-ref "ü" 0)
#\xfc

$> (string->list "über")
(#\xfc #\b #\e #\r)

$> (with-output-to-file "test2" (lambda () (##write-string "ü")
$> ,q

$ cat test2
ü

$ gsi -:d,t8,f8
$> (with-input-from-file "test2" (lambda () (read-char)))
#\xfc


With racket:

$ racket
$>"ü"
"ü"

$> (with-input-from-file "test2" (lambda () (read-char)))
#\ü

$> (string->list "über")
'(#\ü #\b #\e #\r)


Why does gambit return "\374" instead of "ü" in the repl when evaluating
the string "ü"? I'm curious because in racket the repl returns the
evaluated string as "ü"", also read-char in racket returns #\ü instead
of #\xfc.

Looking at the documentation I could change the behaviour with:
;;;;
(output-port-readtable-set!
   (repl-output-port)
   (readtable-max-unescaped-char-set
     (output-port-readtable (repl-output-port))
     #\U0010ffff))
;;;;

Are there any advantages for having this default readtable setting in
gambit? As a beginner I think it's confusing.




More information about the Gambit-list mailing list