<p>Does the list contain non-bytes - ie, values > 255 (or <0)?<br>
Is the list pure (ie, ends with [])?</p>
<p>What you're probably looking for is the encoding functions in the 'unicode' module.</p>
<p>/Erik</p>
<div class="gmail_quote">Den 05/09/2012 08.57 skrev "Martin Dimitrov" <<a href="mailto:mrtndimitrov@gmail.com">mrtndimitrov@gmail.com</a>>:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hello,<br>
<br>
I have a list, representing a UTF8 string, containing more than 225000<br>
elements. I have load it in var L:<br>
<br>
8> lists:flatten(L).<br>
[60,63,120,109,108,32,118,101,114,115,105,111,110,61,34,49,<br>
 46,48,34,32,101,110,99,111,100,105,110,103,61|...]<br>
9> list_to_binary(L).<br>
** exception error: bad argument<br>
     in function  list_to_binary/1<br>
        called as<br>
list_to_binary([60,63,120,109,108,32,118,101,114,115,105,111,<br>
<br>
110,61,34,49,46,48,34,32,101,110,99,111,100,<br>
                                  105,110,103|...])<br>
10> file:write_file("data.txt", L).<br>
{error,badarg}<br>
<br>
Why list_to_binary/1 and write_file/2 fail?<br>
<br>
Best regards,<br>
<br>
Martin<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>
</blockquote></div>