From: John Darrington Date: Tue, 7 Apr 2009 05:00:08 +0000 (+0800) Subject: Issue warning when combining files of distinct encodings X-Git-Tag: v0.7.3~179 X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=99e37c4d062ac23f89070b578f28eb6d49eec632;p=pspp-builds.git Issue warning when combining files of distinct encodings --- diff --git a/src/language/data-io/combine-files.c b/src/language/data-io/combine-files.c index ccbe7679..1a82ef3f 100644 --- a/src/language/data-io/combine-files.c +++ b/src/language/data-io/combine-files.c @@ -488,12 +488,29 @@ merge_dictionary (struct dictionary *const m, struct comb_file *f) struct dictionary *d = f->dict; const char *d_docs, *m_docs; int i; + const char *file_encoding; if (dict_get_label (m) == NULL) dict_set_label (m, dict_get_label (d)); d_docs = dict_get_documents (d); m_docs = dict_get_documents (m); + + + /* If the input files have different encodings, then + */ + file_encoding = dict_get_encoding (f->dict); + if ( file_encoding != NULL) + { + if ( dict_get_encoding (m) == NULL) + dict_set_encoding (m, file_encoding); + else if ( 0 != strcmp (file_encoding, dict_get_encoding (m))) + { + msg (MW, + _("Combining files with incompatible encodings. String data may not be represented correctly.")); + } + } + if (d_docs != NULL) { if (m_docs == NULL)