<div dir="ltr">Hi Raimo, that was even better, thanks!<div><br></div><div>Thomas</div></div><br><div class="gmail_quote"><div dir="ltr">On Thu, 10 Nov 2016 at 08:22 Raimo Niskanen <<a href="mailto:raimo%2Berlang-questions@erix.ericsson.se">raimo+erlang-questions@erix.ericsson.se</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On Wed, Nov 09, 2016 at 08:26:30PM +0000, Thomas Elsgaard wrote:<br class="gmail_msg">
> Thanks! I tried many other things, but you solved it, thanks! Now I also<br class="gmail_msg">
> learned something new today ;-)<br class="gmail_msg">
<br class="gmail_msg">
It might actually be this one you need:<br class="gmail_msg">
<br class="gmail_msg">
2> unicode:characters_to_list([<<"A">>,"4",<<"B">>,"c",<<"d">>]).<br class="gmail_msg">
"A4Bcd"<br class="gmail_msg">
<br class="gmail_msg">
or<br class="gmail_msg">
<br class="gmail_msg">
3> unicode:characters_to_binary([<<"A">>,"4",<<"B">>,"c",<<"d">>]).<br class="gmail_msg">
<<"A4Bcd">><br class="gmail_msg">
<br class="gmail_msg">
if you should want an UTF-8 binary as the result.<br class="gmail_msg">
<br class="gmail_msg">
iolist_to_binary assumes ISO Latin-1 i.e ISO 8859-1 character encoding.<br class="gmail_msg">
The unicode module presumes UTF-8 and enables the choice of most Unicode<br class="gmail_msg">
encodings as well as Latin-1 as well as the choice of outputting a binary<br class="gmail_msg">
or a list.<br class="gmail_msg">
<br class="gmail_msg">
Side not: the term "flattening a list" suggests a list of any type terms.<br class="gmail_msg">
For this task there are functions in the lists module but they flatten<br class="gmail_msg">
just lists and does not convert a contained binary.<br class="gmail_msg">
<br class="gmail_msg">
<br class="gmail_msg">
<br class="gmail_msg">
><br class="gmail_msg">
> Thomas<br class="gmail_msg">
><br class="gmail_msg">
> On Wed, 9 Nov 2016 at 20:50 Brujo Benavides <<br class="gmail_msg">
> <a href="mailto:fernando.benavides@inakanetworks.com" class="gmail_msg" target="_blank">fernando.benavides@inakanetworks.com</a>> wrote:<br class="gmail_msg">
><br class="gmail_msg">
> > Have you tried iolist_to_binary ?<br class="gmail_msg">
> ><br class="gmail_msg">
> > 1> iolist_to_binary([<<"A">>,"4",<<"B">>,"c",<<"d">>]).<br class="gmail_msg">
> > <<"A4Bcd">><br class="gmail_msg">
> > 2> binary_to_list(v(-1)).<br class="gmail_msg">
> > "A4Bcd"<br class="gmail_msg">
> > 3><br class="gmail_msg">
> ><br class="gmail_msg">
> > On Nov 9, 2016, at 16:48, Thomas Elsgaard <<a href="mailto:thomas.elsgaard@gmail.com" class="gmail_msg" target="_blank">thomas.elsgaard@gmail.com</a>><br class="gmail_msg">
> > wrote:<br class="gmail_msg">
> ><br class="gmail_msg">
> > Hi<br class="gmail_msg">
> ><br class="gmail_msg">
> > I am having some difficulties by flattening a list which looks like this:<br class="gmail_msg">
> ><br class="gmail_msg">
> > [<<"A">>,"4",<<"B">>,"c",<<"d">>]<br class="gmail_msg">
> ><br class="gmail_msg">
> > After flattening, it should look like this: A4Bcd<br class="gmail_msg">
> ><br class="gmail_msg">
> > Any good ways to do this ?<br class="gmail_msg">
> ><br class="gmail_msg">
> > Thomas<br class="gmail_msg">
> ><br class="gmail_msg">
> ><br class="gmail_msg">
> ><br class="gmail_msg">
> > _______________________________________________<br class="gmail_msg">
> > erlang-questions mailing list<br class="gmail_msg">
> > <a href="mailto:erlang-questions@erlang.org" class="gmail_msg" target="_blank">erlang-questions@erlang.org</a><br class="gmail_msg">
> > <a href="http://erlang.org/mailman/listinfo/erlang-questions" rel="noreferrer" class="gmail_msg" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br class="gmail_msg">
> ><br class="gmail_msg">
> ><br class="gmail_msg">
> ><br class="gmail_msg">
<br class="gmail_msg">
> _______________________________________________<br class="gmail_msg">
> erlang-questions mailing list<br class="gmail_msg">
> <a href="mailto:erlang-questions@erlang.org" class="gmail_msg" target="_blank">erlang-questions@erlang.org</a><br class="gmail_msg">
> <a href="http://erlang.org/mailman/listinfo/erlang-questions" rel="noreferrer" class="gmail_msg" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br class="gmail_msg">
<br class="gmail_msg">
<br class="gmail_msg">
--<br class="gmail_msg">
<br class="gmail_msg">
/ Raimo Niskanen, Erlang/OTP, Ericsson AB<br class="gmail_msg">
_______________________________________________<br class="gmail_msg">
erlang-questions mailing list<br class="gmail_msg">
<a href="mailto:erlang-questions@erlang.org" class="gmail_msg" target="_blank">erlang-questions@erlang.org</a><br class="gmail_msg">
<a href="http://erlang.org/mailman/listinfo/erlang-questions" rel="noreferrer" class="gmail_msg" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br class="gmail_msg">
</blockquote></div>