Re: Encodings. Paul Schlie (13 Feb 2004 02:18 UTC)
Re: Encodings. Bradd W. Szonye (13 Feb 2004 03:35 UTC)
Re: Encodings. Paul Schlie (13 Feb 2004 05:59 UTC)
Re: Encodings. Bradd W. Szonye (13 Feb 2004 06:36 UTC)
Re: Encodings. Paul Schlie (13 Feb 2004 08:00 UTC)
Re: Encodings. Robby Findler (13 Feb 2004 15:01 UTC)
Re: Encodings. Paul Schlie (13 Feb 2004 17:16 UTC)
Re: Encodings. Paul Schlie (13 Feb 2004 18:19 UTC)
Re: Encodings. Robby Findler (16 Feb 2004 01:03 UTC)
Re: Encodings. Paul Schlie (16 Feb 2004 03:21 UTC)
Re: Encodings. Paul Schlie (16 Feb 2004 04:18 UTC)
Re: Encodings. Robby Findler (16 Feb 2004 04:33 UTC)
Re: Encodings. bear (13 Feb 2004 17:40 UTC)
Re: Encodings. Per Bothner (13 Feb 2004 18:34 UTC)
Re: Encodings. Paul Schlie (13 Feb 2004 19:02 UTC)
Re: Encodings. Bradd W. Szonye (13 Feb 2004 19:05 UTC)
Re: Encodings. Paul Schlie (13 Feb 2004 19:48 UTC)
Re: Encodings. Per Bothner (13 Feb 2004 19:11 UTC)
Re: Encodings. Paul Schlie (13 Feb 2004 19:44 UTC)
Re: Encodings. bear (13 Feb 2004 21:42 UTC)
Re: Encodings. Bradd W. Szonye (13 Feb 2004 21:54 UTC)
Re: Encodings. Paul Schlie (13 Feb 2004 23:45 UTC)
Re: Encodings. Bradd W. Szonye (14 Feb 2004 00:04 UTC)
Re: Encodings. bear (14 Feb 2004 01:06 UTC)
Re: Encodings. Bradd W. Szonye (14 Feb 2004 01:08 UTC)
Re: Encodings. Paul Schlie (14 Feb 2004 02:35 UTC)
Re: Encodings. Bradd W. Szonye (14 Feb 2004 03:00 UTC)
Re: Encodings. Paul Schlie (14 Feb 2004 03:04 UTC)
Re: Encodings. Bradd W. Szonye (14 Feb 2004 03:08 UTC)
Re: Encodings. Paul Schlie (14 Feb 2004 03:29 UTC)
Re: Encodings. Paul Schlie (14 Feb 2004 02:19 UTC)
Re: Encodings. Bradd W. Szonye (14 Feb 2004 03:04 UTC)
Re: Encodings. Paul Schlie (14 Feb 2004 03:10 UTC)
Re: Encodings. Bradd W. Szonye (14 Feb 2004 03:12 UTC)
Re: Encodings. Paul Schlie (13 Feb 2004 22:41 UTC)
Re: Encodings. Bradd W. Szonye (13 Feb 2004 17:55 UTC)
Re: Encodings. Paul Schlie (13 Feb 2004 18:42 UTC)
Re: Encodings. Bradd W. Szonye (13 Feb 2004 18:53 UTC)
Re: Encodings. Ken Dickey (13 Feb 2004 21:53 UTC)
RESET [was Re: Encodings] Ken Dickey (14 Feb 2004 16:19 UTC)
Re: RESET [was Re: Encodings] bear (14 Feb 2004 18:02 UTC)
Re: RESET [was Re: Encodings] Bradd W. Szonye (14 Feb 2004 19:38 UTC)

Re: Encodings. Per Bothner 13 Feb 2004 18:34 UTC

bear wrote:

> If there are multiple encodings/canonicalizations/etc in use
> on a system, let schemes on those systems implement multiple kinds of
> character ports.

I don't think that's a good idea.

> But it follows that there is NO WAY we should rely on I/O of
> characters through character ports to read or write a particular
> binary representation for "raw" data such as sound and image files.

Does not follow.

May I suggest the Kawa solution:

You want to be able to specify character encoding when you open a
file, even if people mostly use a system dependent port.  However
that encoding is specified is orthogoal to my suggestion:  It can
be a parameter object or a option parameter:

(define p (open-input-port "foo.txt" encoding: "ebcdic"))

Add a special encoding for binary files:

(define b (open-input-port "foo.bin" encoding: "binary"))

A "binary" encoding maps the byte n to (integer->char b),
with no translations.

Notice that a Windows or MacOS 8-bit system may do line-end
munging for the default encoding, but is not allowed to do
so for "binary".

> The only reason programmers want to write characters that aren't in
> the "normal" encoding/canonicalization/etc, is when they need really
> close control of the exact format of I/O.  But when you need control
> *that* close, you're not talking about a "character" port at all any
> more; you're talking about binary I/O.  Rather than breaking the
> abstraction barrier on character ports, you need a different kind of
> port.  We need binary ports that support operations like (read-bytes)
> and (write-bytes).

Perhaps if you started from scratch, but my solution is more
compatible with existing Scheme code.
--
	--Per Bothner
xxxxxx@bothner.com   http://per.bothner.com/