https://github.com/processone/iconv
Fast encoding conversion library for Erlang / Elixir
https://github.com/processone/iconv
encoding iconv iconv-library libiconv
Last synced: 27 days ago
JSON representation
Fast encoding conversion library for Erlang / Elixir
- Host: GitHub
- URL: https://github.com/processone/iconv
- Owner: processone
- License: other
- Created: 2016-01-21T10:09:50.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2024-07-26T08:23:40.000Z (about 1 year ago)
- Last Synced: 2025-08-03T07:36:44.345Z (2 months ago)
- Topics: encoding, iconv, iconv-library, libiconv
- Language: Shell
- Size: 224 KB
- Stars: 57
- Watchers: 11
- Forks: 32
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE.txt
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# iconv
[](https://github.com/processone/iconv/actions/workflows/ci.yml)
[](https://coveralls.io/github/processone/iconv?branch=master)
[](https://hex.pm/packages/iconv)Fast encoding conversion library for Erlang / Elixir
This library is a native binding to
[libiconv](https://www.gnu.org/software/libiconv/) library.## Building
iconv library can be build as follow:
./configure && make
iconv is a rebar-compatible OTP application. Alternatively, you can
build it with rebar:rebar compile
## Dependencies
iconv library depends on libiconv.
You can use `configure` option to pass custom path to libiconv
library:--with-libiconv-prefix[=DIR] search for libiconv in DIR/include and DIR/lib
## Usage
You can start iconv with the following command:
```shell
$ erl -pa ebin -pa deps/*/ebin
Erlang/OTP 21 [erts-10.2.1] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [hipe] [dtrace]Eshell V10.2.1 (abort with ^G)
1> application:start(iconv).
ok
2> FromEncoding = <<"utf-8">>.
<<"utf-8">>
3> ToEncoding = <<"iso8859-15">>.
<<"iso8859-15">>
4> Text = <<"Hello">>.
<<"Hello">>
5> iconv:convert(FromEncoding, ToEncoding, Text).
<<"Hello">>
```## Elixir
You can use `iconv` with Elixir `mix` by adding the dependency as follows:
```
defp deps do
[
{:iconv, "~> 1.0.10"},
]
end
``````
$ mix deps.get
...
$ mix deps.compile
...
$ iex -S mix
Erlang/OTP 21 [erts-10.2.1] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [hipe] [dtrace]Interactive Elixir (1.7.4) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)> :iconv.convert("utf-8", "iso8859-15", "Hello")
"Hello"
```## Development
### Test
#### Unit test
You can run eunit test with the command:
$ rebar eunit