[plt-scheme] Why do MzScheme ports not respect the locale's encoding by default?
At 21 Feb 2005 17:53:50 -0500, Jim Blandy wrote:
>
> For what it's worth, I believe this is why ISO C simply promises
> nothing about being able to mix byte and wide character operations on
> streams. In your case, you've got two distinct ports, whereas ISO C
> has one stream with two distinct sets of functions to apply to it, but
> it's essentially the same thing.
>
> As I said to Alex Shinn, I don't think it ends up being important to
> provide those guarantees anyway, because:
> - it's too hard to use them without making assumptions about the
> encoding or the converter,
Intuitively the port has a character encoding that takes effect when
you perform character-level operations, and is ignored when you
perform binary operations. It may be hard to implement, but not to
use.
> - situations where you need to mix byte and character operations are
> almost always "layered", in that you can find the extent of the text
> in bytes without parsing the text into characters, and
Many network protocols mix byte and character data, including HTTP and
FTP. To read a response you need to parse in terms of lines of
characters, and then possibly switch to binary operations for the body
of the response.
--
Alex