From: John Darrington Date: Sun, 29 Mar 2009 10:13:33 +0000 (+0800) Subject: Set dictionary's encoding when reading gnumeric files X-Git-Tag: v0.7.3~188^2 X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c4d10d876429b91862251a8d12556e526113fb79;p=pspp-builds.git Set dictionary's encoding when reading gnumeric files --- diff --git a/src/data/dictionary.c b/src/data/dictionary.c index 6e377f80..b5b6cca5 100644 --- a/src/data/dictionary.c +++ b/src/data/dictionary.c @@ -78,7 +78,8 @@ struct dictionary void dict_set_encoding (struct dictionary *d, const char *enc) { - d->encoding = strdup (enc); + if (enc) + d->encoding = strdup (enc); } const char * diff --git a/src/data/gnumeric-reader.c b/src/data/gnumeric-reader.c index 00a07d2f..f2f4e52f 100644 --- a/src/data/gnumeric-reader.c +++ b/src/data/gnumeric-reader.c @@ -497,6 +497,8 @@ gnumeric_open_reader (struct gnumeric_read_info *gri, struct dictionary **dict) /* Create the dictionary and populate it */ *dict = r->dict = dict_create (); + dict_set_encoding (r->dict, (const char *) xmlTextReaderConstEncoding (r->xtr)); + r->value_cnt = 0; for (i = 0 ; i < n_var_specs ; ++i )