Re: [erlang-questions] Sending String with Unicode Currency Symbols (like ₡) from erlang to C language NIF (Native Implemented functions)

Bob Ippolito <>
Thu Jun 3 19:15:29 CEST 2010

On Thu, Jun 3, 2010 at 10:02 AM, Saurabh Narula
<> wrote:
> Hello Everyone,
> i am trying to send erlang string from erlang program to the NIF
> (Native Implemented functions) written in C language.
> While sending the string from erlang I have an option of specifying
> the encoding. The functions that help me achieve this are
> ERL_NIF_TERM enif_make_string(ErlNifEnv* env, const char* string,
> ErlNifCharEncoding encoding)
> int enif_get_string(ErlNifEnv* env, ERL_NIF_TERM list, char* buf,
> unsigned size, ErlNifCharEncoding encode)
> The only supported encoding is currently ERL_NIF_LATIN1 for
> iso-latin-1 (8-bit ascii), and while sending it back to the erlang I
> can specify the encoding as ERL_NIF_LATIN1, which is the only option
> right now.
> My issue is that my string contains Unicode currency symbols like ₡,
> as the encoding currently only supports ERL_NIF_LATIN1, there is no
> way the NIF library can understand unicode currency symbols. Does
> anybody has any workaround for this?

You could use a UTF-8 encoded binary instead of a list.


More information about the erlang-questions mailing list