<br><br><div class="gmail_quote">On Mon, Jan 21, 2013 at 9:13 PM, Dmitry Kolesnikov <span dir="ltr"><<a href="mailto:dmkolesnikov@gmail.com" target="_blank">dmkolesnikov@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi Steve,<br>
<br>
There is a well document External Term Format protocol. I am not here to judge that protocol but it is implementable on other languages as well (<a href="https://github.com/rustyio/BERT-JS" target="_blank">https://github.com/rustyio/BERT-JS</a>). Yes, it make sense in scopes of that protocol specification.<br>
<br>
Long time ago, I've been trying to use it for WebApp development and … switched to JSON. :-)<br></blockquote><div><br></div><div>There is a slight problem here. Binary data arriving on sockets often ends </div><div>up stored in javascript as UTF-8 strings - but these is no guarantee that</div>
<div>an arbitrary erlang term when converted to the external format is a valid</div><div>UTF8 string ....</div><div><br></div><div>/Joe</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
But I strongly believe that External Term Format make sense for other use-case...<br>
<br>
<br>
Best Regards,<br>
Dmitry<br>
<div class="HOEnZb"><div class="h5"><br>
<br>
On Jan 21, 2013, at 10:00 PM, Steve Davis <<a href="mailto:steven.charles.davis@gmail.com">steven.charles.davis@gmail.com</a>> wrote:<br>
<br>
> Hi Dmitry,<br>
><br>
> It "makes sense" only if the "binary_to_term" decode is done in erlang.<br>
><br>
> br,<br>
> /s<br>
><br>
> On Jan 21, 2013, at 1:53 PM, Dmitry Kolesnikov <<a href="mailto:dmkolesnikov@gmail.com">dmkolesnikov@gmail.com</a>> wrote:<br>
><br>
>> Hello,<br>
>><br>
>> This make sense to me!<br>
>><br>
>> term_to_binary/1 returns a binary data object which is the result of encoding Term according to the Erlang external term format. See <a href="http://erlang.org/doc/apps/erts/erl_ext_dist.html" target="_blank">http://erlang.org/doc/apps/erts/erl_ext_dist.html</a><br>
>><br>
>> Use list_to_binary or unicode:character_to_binary depends on your use-case.<br>
>><br>
>> - Dmitry<br>
>><br>
>> On Jan 21, 2013, at 9:38 PM, Steve Davis <<a href="mailto:steven.charles.davis@gmail.com">steven.charles.davis@gmail.com</a>> wrote:<br>
>><br>
>>> The following appears to encode lists of integers as strings (?!?):<br>
>>><br>
>>> Eshell V5.9.3 (abort with ^G)<br>
>>> 1> term_to_binary([1,2,3,4]).<br>
>>> <<131,107,0,4,1,2,3,4>><br>
>>><br>
>>> Is there a reason for this that I'm missing?<br>
>>><br>
>>> regs,<br>
>>> /s<br>
>>><br>
>>> _______________________________________________<br>
>>> erlang-questions mailing list<br>
>>> <a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br>
>>> <a href="http://erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br>
>><br>
><br>
<br>
_______________________________________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br>
<a href="http://erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br>
</div></div></blockquote></div><br>