/*
 * call-seq:
 *   IDN::Stringprep.nfkc_normalize(string) => string
 *
 * Converts a string in UTF-8 format into canonical form, standardizing
 * such issues as whether a character with an accent is represented as a
 * base character and combining accent or as a single precomposed character.
 */

static VALUE nfkc_normalize(VALUE self, VALUE str)
{
  char *buf;
  VALUE retv;

  str = rb_check_convert_type(str, T_STRING, "String", "to_s");
  buf = stringprep_utf8_nfkc_normalize(RSTRING(str)->ptr, RSTRING(str)->len);

  retv = rb_str_new2(buf);
  xfree(buf);
  return retv;
}