Sending String with Unicode Currency Symbols (like ₡) from erlang to C language NIF (Native Implemented functions)

Saurabh Narula reachsaurabhnarula@REDACTED
Thu Jun 3 19:02:45 CEST 2010


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?

I want to thank you in advance, and would really appreciate any help
from the members.

Regards,
Saurabh


More information about the erlang-questions mailing list