From 0b62acd9868ac597749650c837618fcc5a18f832 Mon Sep 17 00:00:00 2001 From: frazze-jobb Date: Thu, 11 May 2023 17:37:46 +0200 Subject: stdlib: update doc regarding escript raw bytes incompatibility --- erts/doc/src/escript_cmd.xml | 5 +++-- lib/stdlib/doc/src/io.xml | 9 +++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/erts/doc/src/escript_cmd.xml b/erts/doc/src/escript_cmd.xml index 78b121ee97..06c245006b 100644 --- a/erts/doc/src/escript_cmd.xml +++ b/erts/doc/src/escript_cmd.xml @@ -118,9 +118,10 @@ $ escript factorial 5 applies to the script itself. The encoding of the I/O-server, however, must be set explicitly as follows:

-io:setopts([{encoding, unicode}]) +io:setopts([{encoding, latin1}])

The default encoding of the I/O-server for standard_io - is latin1, as the script runs in a non-interactive terminal + is unicode if its supported, as the script runs in a + non-interactive terminal. (see section Summary of Options) in the STDLIB User's Guide.

diff --git a/lib/stdlib/doc/src/io.xml b/lib/stdlib/doc/src/io.xml index a1c467ca1c..2a25163e3a 100644 --- a/lib/stdlib/doc/src/io.xml +++ b/lib/stdlib/doc/src/io.xml @@ -1157,6 +1157,15 @@ enter>1.0er.

This option is supported by the standard shell (group.erl), the 'oldshell' (user.erl), and the file I/O servers.

+ + Since OTP 26 user.erl has been deprecated, all I/O is now passed + through group.erl. I/O defaults to unicode if its supported, otherwise + latin1 (0-127), all text is however converted to unicode as an intermediate + representation. This means that 128-255 will be converted to unicode. + If you have an escript that sends raw bytes on standard_io, those bytes + will be translated to unicode and then back to latin1. + To avoid this, set the encoding to latin1. + {echo, boolean()} -- cgit v1.2.1