After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 658916 - Fail to import some csv files
Fail to import some csv files
Status: RESOLVED FIXED
Product: Gnumeric
Classification: Applications
Component: import/export Text
unspecified
Other Linux
: Normal normal
: ---
Assigned To: Morten Welinder
Jody Goldberg
Depends on:
Blocks:
 
 
Reported: 2011-09-13 13:25 UTC by Jean Bréfort
Modified: 2011-09-13 18:42 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
sample file (4.09 KB, text/csv)
2011-09-13 13:25 UTC, Jean Bréfort
Details
The real sample (8.93 KB, text/csv)
2011-09-13 13:44 UTC, Jean Bréfort
Details

Description Jean Bréfort 2011-09-13 13:25:47 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.
Comment 1 Jean Bréfort 2011-09-13 13:44:10 UTC
Created attachment 196373 [details]
The real sample
Comment 2 Andreas J. Guelzow 2011-09-13 15:00:47 UTC
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()
Comment 3 Morten Welinder 2011-09-13 15:20:08 UTC
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.
Comment 4 Andreas J. Guelzow 2011-09-13 18:42:34 UTC
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.