Convert to utf8 in data_out function.
[pspp-builds.git] / src / data / variable.c
index 8d85b518a5f8325dbef9c257e8af20d2ca21ab3a..0b5ca26c977236aff6992806a92a1a5a6adc6bc7 100644 (file)
@@ -590,10 +590,12 @@ var_append_value_name (const struct variable *v, const union value *value,
                       struct string *str)
 {
   const char *name = var_lookup_value_label (v, value);
+  const struct dictionary *dict = var_get_vardict (v)->dict;
   if (name == NULL)
     {
-      char *s = ds_put_uninit (str, v->print.w);
-      data_out (value, &v->print, s);
+      char *s = data_out (value, dict_get_encoding (dict), &v->print);
+      ds_put_cstr (str, s);
+      free (s);
     }
   else
     ds_put_cstr (str, name);