I'm writing a code that read a csv file in erlang.
I get a string from the csv, for example:
Alexander Bubeck|Florian Weißhardt|Matthias Gruhler|Ulrich Reiser
And than I use this commands in order to turn it to list and print it to the terminal:
Authors = string:tokens(element(2,Row),[$|]),
io:format("The authors in row ~p are: ~p~n", [Num,Authors])
The problem is in this name: Florian Weißhardt
Because it has a non English letter the output is [70,108,111,114,105,97,110,32,87,101,105,195,159, 104,97,114,100,116]
How can I resolve this?
Thanks
Try convert list to binary in utf8
unicode format:
1> 1> Authors = [70,108,111,114,105,97,110,32,87,101,105,195,159, 104,97,114,100,116].
[70,108,111,114,105,97,110,32,87,101,105,195,159,104,97,114, 100,116]
2> io:format("The authors: ~ts~n", [list_to_binary(Authors)]).
The authors: Florian Weißhardt
ok
3> list_to_binary(Authors).
<<"Florian Weißhardt"/utf8>>