[ejabberd] How to get regular C-style string from jlib

Mickaël Rémond mremond at process-one.net
Mon Mar 2 11:43:41 MSK 2015


Please, note that as there is no Erlang string, both representation are
valid "string".

On  2 Mar 2015, monkeyfdude at gmail.com wrote:

> Hi,
> All the xml elements returns value is format like
> <<"1234567890123111">>

This is a binary.

> How can I get or convert this value to
> "1234567890123111"

This is a list. You can convert it to list:

Eshell V6.3  (abort with ^G)
1> binary_to_list(<<"1234567890123111">>).

Please, note that if you can, keep binary as they consume less
memory. We switched in 2013 from list representation to binary as a huge
effort to optimize ejabberd memory consumption.

Best regards,

Mickaël Rémond

More information about the ejabberd mailing list