Subject: call-with-input-file and call-with-output-file should use textual ports
From: Göran Weinholt <[email-masked]>
To: [email-masked]
Date: Tue, 31 Jul 2018 09:14:12 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

Hello schemers,

the call-with-input-file and call-with-output-file procedures in (rnrs
io simple) should open textual ports. In Guile 2.2.4, they open binary
ports:

  (define (call-with-input-file filename proc)
    (call-with-port (open-file-input-port filename) proc))

  (define (call-with-output-file filename proc)
    (call-with-port (open-file-output-port filename) proc))

Changing the inner calls to open-input-file and open-output-file is
sufficient to fix this bug.

A consequence of using binary ports here is that the I/O is not
transcoded, so UTF-8 data is corrupted.

-- 
Göran Weinholt
Debian developer
73 de SA6CJK