Skip to content

PowerMeMobile/eiconv

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

62 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Erlang NIF wrapper for iconv

Test Hex pm

An Erlang wrapper for the character set conversion utility iconv.

Getting started

Include as a dependency

Using rebar3, add the dependency to your rebar.config file:

{deps, [
    {eiconv, "1.0.0"},
    %% ...
]}.

and run $ rebar3 compile.

Use eiconv module

To convert from utf-8 to ascii:

ToConvert = "123",
{ok, Converted} = eiconv:convert("utf-8", "ascii", ToConvert)),
io:format("Converted '~s' to '~s'~n", [ToConvert, Converted])

eiconv API

Using convert/3

{ok, Converted} = eiconv:convert("utf-8", "ascii", "123"))

Using CD (Conversion Descriptor)

{ok, CD} = eiconv:open("utf8", "ascii"),
{ok, Converted} = eiconv:conv(CD, "123")),
ok = eiconvclose(CD)

iconv API

Using convert/3

Converted = eiconv:convert("utf-8", "ascii", "123"))

(Note it return directly the converted text and not a tuple {ok, Converted})

Authors

Wrapper provided by Maas-Maarten Zeeman and the Zotonic team.

About

Erlang iconv NIF wrapper

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Erlang 57.8%
  • C 39.1%
  • Makefile 3.1%