[erlang-questions] byte() vs. char() use in documentation

Robert Virding robert.virding@REDACTED
Mon May 2 11:35:18 CEST 2011


----- "Raimo Niskanen" <raimo+erlang-questions@REDACTED> wrote:

> On Mon, May 02, 2011 at 12:01:49AM +0100, James Churchman wrote:
> > more of a question than an actual answer, but in erlang can erlang
> strings ( therefore io-lists) be utf-16?
> 
> A string is a list of unicode code points.
> 
> An IO-list is a list of binaries or bytes.
> 
> > 
> > I assume that binaries are obviously only ever utf8 representation,
> but a list of ints can obviously exceed number above 255..
> 
> You can choose your binary representation. See erlang man page
> unicode(3).
> 
> > 
> > so maybe (??) the answer is
> > 
> > a) iolist CAN be a  char() (.. this is surely especially true if the
> data is only being messages threw erlang from other systems)
> 
> No. byte().

As a string is a list of unicode code points and an iolist can contain a string then its type must also be char().

Robert



More information about the erlang-questions mailing list