Re: [eclipse-clp-users] Setting encoding for I/O

From: Joachim Schimpf <jschimpf_at_...311...>
Date: Thu, 7 Jul 2016 13:34:10 +0100
On 07/07/16 07:52, mskala_at_...206... wrote:
> I'd like to be able to read and write bytes (not necessarily characters)
> from standard input and output, regardless of locale settings and possibly
> including sequences that are not valid in the locale.  How can I do this?
>
> I've been able to find get_stream_info/3, which looks like it will tell me
> the current encoding setting for a stream, and it looks like "octet" is
> the one I want; but I haven't found any documented way to *set* this.
>

You can set this immediately when opening a stream, e.g.

     open(File, read, Stream, [encoding(octet)])

or afterwards with

     set_stream_property(Stream, encoding, octet)

I see the latter is missing from the documentation of set_stream_property/3,
I'll update this.

Cheers,
-- Joachim
Received on Thu Jul 07 2016 - 12:34:17 CEST

This archive was generated by hypermail 2.3.0 : Wed Sep 25 2024 - 15:13:21 CEST