struct vector **vector; /* Vectors of variables. */
size_t vector_cnt; /* Number of vectors. */
struct attrset attributes; /* Custom attributes. */
+
+ char *encoding; /* Character encoding of string data */
+
const struct dict_callbacks *callbacks; /* Callbacks on dictionary
modification */
void *cb_data ; /* Data passed to callbacks */
void *changed_data;
};
+
+void
+dict_set_encoding (struct dictionary *d, const char *enc)
+{
+ d->encoding = strdup (enc);
+}
+
+const char *
+dict_get_encoding (const struct dictionary *d)
+{
+ return d->encoding ;
+}
+
+
void
dict_set_change_callback (struct dictionary *d,
void (*changed) (struct dictionary *, void*),
for (i = 0; i < s->vector_cnt; i++)
d->vector[i] = vector_clone (s->vector[i], s, d);
+ d->encoding = strdup (s->encoding);
+
dict_set_attributes (d, dict_get_attributes (s));
return d;
void dict_set_attributes (struct dictionary *, const struct attrset *);
bool dict_has_attributes (const struct dictionary *);
+
+void dict_set_encoding (struct dictionary *d, const char *enc);
+const char *dict_get_encoding (const struct dictionary *d);
+
+
/* Functions to be called upon dictionary changes. */
struct dict_callbacks
{
case 20:
/* New in SPSS 16. Contains a single string that describes
the character encoding, e.g. "windows-1252". */
- break;
+ {
+ char *encoding = calloc (size, count + 1);
+ read_string (r, encoding, count + 1);
+ dict_set_encoding (dict, encoding);
+ return;
+ }
case 21:
/* New in SPSS 16. Encodes value labels for long string
if (from == NULL)
from = default_encoding;
-
- fprintf (stderr, "from: %s; to %s\n", from, to);
-
if ( 0 == strcmp (to, from))
return xstrndup (text, length);
const gchar *
psppire_dict_encoding (const PsppireDict *dict)
{
- return NULL;
+ return dict_get_encoding (dict->dict);
}