Skip to content
Erlang libiconv binding (This library is gentle on the scheduler and can do streaming)
Erlang C Makefile
Find file
Pull request Compare This branch is 53 commits ahead, 5 commits behind iamaleksey:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
c_src
priv
src
test
.gitignore
Makefile
README.md
rebar
rebar.config

README.md

About

This new version adds support for streaming. You can now have low level access to iconverl:iconv/2 in case you really need it or you can use the iconverl:chunk/2 function for a simpler interface. Currently only two implementations are recommended this one and eiconv. Backwards compatibility with erlang-iconv, the old iconverl and eiconv is also provided. So you can use this library as a drop in replacement for existing ones.

Note that this is a complete rewrite of iamaleksey/iconverl which has significant improvements.

Compilation

make

Usage

1> CD = iconverl:open("ucs-2be", "utf-8").
<<>>
2> iconverl:conv(CD, <<"text">>).
{ok,<<0,116,0,101,0,120,0,116>>}
3> iconverl:conv(CD, <<"more text to convert">>).
{ok,<<0,109,0,111,0,114,0,101,0,32,0,116,0,101,0,120,0,
      116,0,32,0,116,0,111,0,32,0,...>>}
4> iconverl:conv("ucs-4", "latin1", <<"convert with a single function call">>).
{ok,<<0,0,0,99,0,0,0,111,0,0,0,110,0,0,0,118,0,0,0,101,0,
      0,0,114,0,0,0,...>>}

Or using the standard iconv interface (recommended):

1> l(iconv).
{module,iconv}
2> {ok, Cd} = iconv:open("latin1//translit", "utf-8").
{ok,<<>>}
3> iconv:conv(Cd, unicode:characters_to_binary("Test∀", utf8)).
{ok,<<"Test?">>}
4> iconv:close(Cd).
ok
5>
Something went wrong with that request. Please try again.