Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
77 lines (61 sloc) 2.22 KB


Erlang-iconv is a fork of the iconv in Jungerl. I pulled it out of jungerl because I only wanted iconv, not all the other stuff in jungerl and because the jungerl build system wasn't very helpful on anything but linux.

erlang-iconv has been built and tested on the following platforms:

  • Linux
  • FreeBSD
  • OpenBSD
  • OSX

It should also build on NetBSD and most other UNIX-like systems. I haven't bothered to try on windows yet.


Here's some sample usage converting some shift-jis text to utf-8:

1> iconv:start().
2> X = <<83,97,109,112,108,101,58,32,142,132,32,130,205,32,131,67,32,131,147,32,131,79,32,131,71,32,130,197,32,130,183,13,10>>.
3> io:format("~s~n", [X]).
         Í C  O G Å ·

4> io:format("~ts~n", [X]).
** exception exit: {badarg,[{io,format,
     in function  io:o_request/3
5> {ok, CD} = iconv:open("utf-8", "shift-jis").
6> {ok, Output} = iconv:conv(CD, X).
7> io:format("~ts~n", [Output]).
Sample: 私 は イ ン グ エ で す
8> iconv:close(CD).

As you can see, before we passed it through iconv it was an unprintable mess.


To install, use rake:

sudo rake install

If the compilation of the C part fails with errors about iconv, you have to specify the prefix where iconv is located, for example on FreeBSD:

rake iconv=/usr/local

And if you don't have iconv or it's development header installed (and iconv isn't part of your C libary) install it.