[erlang-questions] strings vs binaries
Loïc Hoguin
essen@REDACTED
Wed Aug 19 14:20:36 CEST 2015
On 08/19/2015 02:04 PM, zxq9 wrote:
> For example:
>
> 1> io:format("~ts~n", [[["何か","何々"],"So why is this working?",<<"何か"/utf8>>]]).
> 何か何々So why is this working?何か
> ok
I'm not sure how ~ts works but since it's not expecting iolist() I'm
only half surprised.
Here's one though:
1> file:write_file("/tmp/test.txt", [["何か","何々"],"So why is this
working?",<<"何か"/utf8>>]).
{error,badarg}
2> file:write_file("/tmp/test.txt", ["So why is this working?",<<"何
か"/utf8>>]).
ok
Here's another:
3> {ok, S} = gen_tcp:connect("google.com", 80, []).
{ok,#Port<0.548>}
4> gen_tcp:send(S, [["何か","何々"],"So why is this working?",<<"何
か"/utf8>>]).
{error,einval}
5>
=ERROR REPORT==== 19-Aug-2015::14:19:52 ===
Bad value on output port 'tcp_inet'
5> gen_tcp:send(S, ["So why is this working?",<<"何か"/utf8>>]).
ok
Cheers,
--
Loïc Hoguin
http://ninenines.eu
Author of The Erlanger Playbook,
A book about software development using Erlang
More information about the erlang-questions
mailing list