+ const xmlChar *enc = xmlTextReaderConstEncoding (sd->xtr);
+ xmlCharEncoding xce = xmlParseCharEncoding (CHAR_CAST (const char *, enc));
+
+ if ( XML_CHAR_ENCODING_UTF8 != xce)
+ {
+ /* I have been told that ALL gnumeric files are UTF8 encoded. If that is correct, this
+ can never happen. */
+ msg (MW, _("The gnumeric file `%s' is encoded as %s instead of the usual UTF-8 encoding. "
+ "Any non-ascii characters will be incorrectly imported."),
+ r->spreadsheet.file_name,
+ enc);
+ }
+ }
+
+ return r;
+}
+
+
+struct spreadsheet *
+gnumeric_probe (const char *filename, bool report_errors)
+{
+ struct gnumeric_reader *r = gnumeric_reopen (NULL, filename, report_errors);
+
+ return &r->spreadsheet;
+}
+
+
+struct casereader *
+gnumeric_make_reader (struct spreadsheet *spreadsheet,
+ const struct spreadsheet_read_options *opts)
+{
+ int type = 0;
+ int x = 0;
+ struct gnumeric_reader *r = NULL;
+ unsigned long int vstart = 0;
+ int ret;
+ casenumber n_cases = CASENUMBER_MAX;
+ int i;
+ struct var_spec *var_spec = NULL;
+ int n_var_specs = 0;
+
+ r = (struct gnumeric_reader *) (spreadsheet);
+
+ r = gnumeric_reopen (r, NULL, true);
+
+ if ( opts->cell_range )
+ {
+ if ( ! convert_cell_ref (opts->cell_range,