[erlang-questions] list manipulation
Erik Søe Sørensen
eriksoe@REDACTED
Wed Sep 5 09:07:46 CEST 2012
Does the list contain non-bytes - ie, values > 255 (or <0)?
Is the list pure (ie, ends with [])?
What you're probably looking for is the encoding functions in the 'unicode'
module.
/Erik
Den 05/09/2012 08.57 skrev "Martin Dimitrov" <mrtndimitrov@REDACTED>:
> Hello,
>
> I have a list, representing a UTF8 string, containing more than 225000
> elements. I have load it in var L:
>
> 8> lists:flatten(L).
> [60,63,120,109,108,32,118,101,114,115,105,111,110,61,34,49,
> 46,48,34,32,101,110,99,111,100,105,110,103,61|...]
> 9> list_to_binary(L).
> ** exception error: bad argument
> in function list_to_binary/1
> called as
> list_to_binary([60,63,120,109,108,32,118,101,114,115,105,111,
>
> 110,61,34,49,46,48,34,32,101,110,99,111,100,
> 105,110,103|...])
> 10> file:write_file("data.txt", L).
> {error,badarg}
>
> Why list_to_binary/1 and write_file/2 fail?
>
> Best regards,
>
> Martin
>
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20120905/ac231312/attachment.htm>
More information about the erlang-questions
mailing list