[erlang-questions] unexpected result of term_to_binary

Steve Davis <>
Tue Jan 22 00:48:04 CET 2013


If you mean web sockets, then it's important to flag the web socket message as being binary (opcode 2) rather than flagging it as text (opcode 1). 

It certainly makes no sense to send external term format to JavaScript as "text". The onus is on the sender.

/s

On Jan 21, 2013, at 2:49 PM, Joe Armstrong <> wrote:
> 
> There is a slight problem here. Binary data arriving on sockets often ends 
> up stored in javascript as UTF-8 strings - but these is no guarantee that
> an arbitrary erlang term when converted to the external format is a valid
> UTF8 string ....
> 
> /Joe
>  



More information about the erlang-questions mailing list