savonet / ocaml-taglib

OCaml bindings to taglib.
http://liquidsoap.info/
Other
10 stars 1 forks source link

Problems with Unicode strings #4

Closed ul closed 7 years ago

ul commented 7 years ago

It seems like using set_properties doesn't set encoding byte. Strings are written in UTF-8, but then read as if they were Latin-1.

ul commented 7 years ago

This code works, but probably it's not the best solution:

    for (j = 0; j < Wosize_val(caml_values); j++) {
      std::string s = String_val(Field(caml_values,j));
      String *value = new String(s, String::UTF8);
      values->append(*value);
    }

instead of https://github.com/savonet/ocaml-taglib/blob/master/src/taglib_stubs.cc#L404

toots commented 7 years ago

Actually it is the right solution. The binding was written with the assumption that all string are UTF8, as documented in the .mli interface. Thanks!