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()}
@@ -1220,13 +1211,19 @@ fun("") -> {yes, "quit", []};
is in {encoding, unicode} mode if the I/O device supports
it. The mode can be changed, if the assumption of the runtime
system is wrong, by setting this option.
-
The I/O device used when Erlang is started with the "-oldshell"
- or "-noshell" flags is by default set to latin1 encoding,
- meaning that any characters > codepoint 255 are escaped
- and that input is expected to be plain 8-bit ISO Latin-1.
- If the encoding is changed to Unicode, input and output from
- the standard file descriptors are in UTF-8 (regardless of
- operating system).
+
+ Prior to OTP 26.0, when Erlang was started with the
+ -oldshell or -noshell flags (for example, in an
+ escript), the default encoding for standard_io was
+ set to latin1, meaning that any characters > codepoint
+ 255 were escaped and that input was expected to be plain 8-bit
+ ISO Latin-1. As of OTP 26.0, standard_io always defaults
+ to unicode if its supported, otherwise latin1.
+
+ If you want to send raw bytes on standard_io, you now
+ always need to explicitly set the encoding to latin1;
+ otherwise, code points 128-255 will be converted to UTF-8.
+
Files can also be set in {encoding, unicode}, meaning
that data is written and read as UTF-8. More encodings are
possible for files, see below.