Sun Oct 24 10:55:52 CEST 2021
In my opinion, this should not be done, strings and in particular unicode
to be very confusing as it is with two representations in OTP APIs.
UTF-8 (and friends) is an encoding of UNICODE codepoints, you should never
operate on the encoding
On Sun, Oct 24, 2021 at 10:35 AM Michael Truog <mjtruog@REDACTED> wrote:
> I was wondering if there was interest in modifying the io interpretation
> of "~ts" to allow an integer between the t and s for forcing a
> particular unicode interpretation. That would allow a list of bytes to
> be interpreted as UTF8, to provide the same output as a binary:
> 1> io:format("~ts~n",[<<16#C2,16#A2>>]).
> 2> io:format("~t8s~n",[[16#C2,16#A2]]).
> I was also wondering if bytestring types would be added to Erlang/OTP,
> -type nonempty_bytestring() :: nonempty_list(byte()).
> -type bytestring() :: list(byte()).
> They are useful in iolists to ensure only bytes (not other integers) are
> in nested lists.
> Best Regards,
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the erlang-questions