Skip to content

zotonic/eiconv

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

77 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status Hex.pm version Hex.pm Downloads Hex.pm Documentation Erlang Versions License

Erlang NIF wrapper for iconv

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.

Packages

No packages published

Languages

  • Erlang 60.9%
  • C 35.4%
  • Makefile 3.7%