[erlang-questions] cookbook entry #1 - unicode/UTF-8 strings
Thu Oct 20 11:18:03 CEST 2011
Le 19 oct. 2011 à 22:14, Michael Uvarov a écrit :
> Q: Is it easy to work with a list of code points?
> A: Both yes and no.
> I you have an algorithm, which is based on code-paint processing, then
> it will be easy to implement. If you only pass text from point A to
> point B, I suggest keep a string as a binary. Also you can use both
> UTF-8 binaries and lists together to create an iolist from them.
> Best regards,
> Uvarov Michael
From what I understand, iolist() have no notion of encoding whatsoever
and don't represent code points or characters, they are just sequences of
Even though the typespec documentation says they can contain chars ,
erl says otherwise:
** exception error: bad argument
in function iolist_to_binary/1
called as iolist_to_binary()
See also how io:format/2's "t" modifier behaves when used with "~s" ,
iolist() and unicode:charlist()  are not the same types.
That has been already discussed on the ml a few months ago .
Anthony Ramine / @nokusu
Dev:Extend — http://dev-extend.eu/
So as I pray, “Unlimited Erlang Works”
More information about the erlang-questions