I have two variable as below:
A = <<"سعید"/utf8>>,
B = <<"حیدری"/utf8>>,
how can i concat A
and B
?
C = <<A/utf8, B/utf8>>.
line above returns exception error: bad argument
I have two variable as below:
A = <<"سعید"/utf8>>,
B = <<"حیدری"/utf8>>,
how can i concat A
and B
?
C = <<A/utf8, B/utf8>>.
line above returns exception error: bad argument
utf8
is just encoding. It is binary as any other binary:
1> A = <<"سعید"/utf8>>,
1> B = <<"حیدری"/utf8>>,
1> C = <<A/bytes, B/bytes>>.
<<216,179,216,185,219,140,216,175,216,173,219,140,216,175,
216,177,219,140>>
2> io:put_chars([C, $\n]).
سعیدحیدری
ok
P.S.: The result is shown reversed because of web browser behavior. It is shown in correct order in the console.