unicode - Parse UTF-8 in Erlang R15 -
erlang r15!
i have utf-8 encoded binary. need parse unicode string (list). there way it?
the unicode lib you.
bin = <<"hello">>. unicode:characters_to_list(bin, utf8). best practice avoiding encoding troubles in erlang:
always handle utf8 data binaries , unicode data erlang lists
this best practice make life easier. handy follow rule because makes usage of available erlang modules unicode handling smooth.
and here more nice shell tools use when debugging encoding problems:
force erlang shell print characters (a list of numbers):
io:put_chars([229,228,246]). åäö note: printed shell encoding, make sure shell has encoding want see result in.
force elrang shell print numbers:
io:format("~w~n", ["åäö"]). [229,228,246]
Comments
Post a Comment