#include <locale.h> #include <langinfo.h> #include <caml/mlvalues.h> #include <caml/memory.h> #include <caml/alloc.h> value caml_setlocale(value locale){ CAMLparam1 (locale); setlocale (LC_ALL, String_val (locale)); CAMLreturn (Val_int (0)); } value get_enc(value unit){ CAMLparam1 (unit); char *s; s = nl_langinfo (CODESET); if (s == NULL) s = "INVARIANT"; CAMLreturn (copy_string (s)); }