GNOME Bugzilla – Bug 658916
Fail to import some csv files
Last modified: 2011-09-13 18:42:34 UTC
Created attachment 196369 [details] sample file Attached file is not correctly imported, probably because the nul bytes are transformed to spaces. localc does import it correctly.
Created attachment 196373 [details] The real sample
If in stf_open_and_read I comment out: /* cpointer = (char *)result; */ /* while (*cpointer != 0) */ /* cpointer++; */ /* while (cpointer != ((char *)result + *readsize)) { */ /* null_chars++; */ /* *cpointer = ' '; */ /* while (*cpointer != 0) */ /* cpointer++; */ /* } */ /* if (null_chars > 0) { */ /* gchar const *format; */ /* gchar *msg; */ /* format = ngettext ("The file contains %d NULL character. " */ /* "It has been changed to a space.", */ /* "The file contains %d NULL characters. " */ /* "They have been changed to spaces.", */ /* null_chars); */ /* msg = g_strdup_printf (format, null_chars); */ /* stf_warning (context, msg); */ /* g_free (msg); */ /* } */ then the import nearly works, with a problem of an invalid UTF8 string in A4 and a few warnings: (gnumeric:6061): Gtk-CRITICAL **: gtk_bin_get_child: assertion `GTK_IS_BIN (bin)' failed (gnumeric:6061): GLib-GObject-WARNING **: invalid (NULL) pointer instance (gnumeric:6061): GLib-GObject-CRITICAL **: g_signal_connect_data: assertion `G_TYPE_CHECK_INSTANCE (instance)' failed (gnumeric:6061): GLib-GObject-WARNING **: /build/buildd/glib2.0-2.28.6/./gobject/gsignal.c:2275: signal `expose_event' is invalid for instance `0x9f1bad0' (gnumeric:6061): Pango-WARNING **: Invalid UTF-8 string passed to pango_layout_set_text()
Well, that code is just plain wrong, :-( Looking for NULs is fine, but it must be done after conversion to UTF-8 Otherwise, any ascii character encoded in UTF-16[LB]E will trigger this.
This problem has been fixed in the development version. The fix will be available in the next major software release. Thank you for your bug report.