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 511135 - weird behavior of xls files with non ascii characters on loading
weird behavior of xls files with non ascii characters on loading
Status: RESOLVED FIXED
Product: Gnumeric
Classification: Applications
Component: import/export MS Excel (tm)
git master
Other All
: Normal normal
: ---
Assigned To: Morten Welinder
Jody Goldberg
Depends on:
Blocks:
 
 
Reported: 2008-01-21 21:42 UTC by Jean Bréfort
Modified: 2011-08-10 21:16 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
a simple file showing the issue (5.50 KB, application/vnd.ms-excel)
2008-01-21 21:43 UTC, Jean Bréfort
  Details
Proposed patch (878 bytes, patch)
2008-01-26 23:13 UTC, Morten Welinder
none Details | Review
sample file (10.77 KB, application/x-gnumeric)
2008-01-27 18:36 UTC, Jean Bréfort
  Details

Description Jean Bréfort 2008-01-21 21:42:34 UTC
If an xls file contains a formula resulting in a string containing at least one non-ascii character, an extra charater is added when loading. Pressing F9 removes the extra character.
Comment 1 Jean Bréfort 2008-01-21 21:43:51 UTC
Created attachment 103371 [details]
a simple file showing the issue
Comment 2 Morten Welinder 2008-01-22 18:37:34 UTC
What made that file?  Gnumeric or something else?
Comment 3 Morten Welinder 2008-01-22 18:53:16 UTC
It seems we are confusing character length and byte length somehow here.


Feuille1!A1 = xf(0x15) = style (0x9b4ba8) [LEN = 10]
Opcode: 0x6
Feuille1!A2 = xf(0x15) = style (0x9b4ba8) [LEN = 27]
Formula in Feuille1!A2 has recalc tag 0x0;
String len 2, byte length 5: UTF16  :
       0 | 01 e9 00 d7 00 XX XX XX XX XX XX XX XX XX XX XX | .....***********
Opcode: 0xd7

Notice that the string we see seems to include the next opcode.
Comment 4 Jean Bréfort 2008-01-22 21:03:31 UTC
The file was made with gnumeric
Comment 5 Morten Welinder 2008-01-23 15:39:55 UTC
The problem is on the write side, not the read side.  I do not understand
why we need "output_len++;" here.


		if (flags & STR_LEN_IN_BYTES)
			output_len = out_bytes - offset;
		else {
			if (byte_len > 0)
				output_len = g_utf8_pointer_to_offset (txt, in_bytes);
			else
				output_len = char_len;
			output_len++;
		}
Comment 6 Morten Welinder 2008-01-26 23:13:13 UTC
Created attachment 103792 [details] [review]
Proposed patch

Jean, please try this patch.  I do not see any ill effect in my 30s of
testing.  Note: you will have to resave the file.
Comment 7 Jean Bréfort 2008-01-27 06:10:45 UTC
It works, thanks.
Comment 8 Morten Welinder 2008-01-27 17:14:54 UTC
Jean, could you produce a non-ascii test sheet?  One that exercises non-ascii
anywhere you can think of.

* Sheet names
* Range names
* Formula
* Cells with strings
* Cells with string result
* Cells with rich text
* String constants as part of formulas
* Page headers
* Graphs
* ...

Thanks
Comment 9 Jean Bréfort 2008-01-27 18:36:49 UTC
Created attachment 103830 [details]
sample file

Morten, is this what you want?
Comment 10 Morten Welinder 2008-01-27 22:05:34 UTC
Precisely.  Thanks.

Saving as xls and loading the result, I get the barfage below.  And something
is wrong with cell A6 (rich text).

(lt-gnumeric:20573): gnumeric:read_expr-WARNING **: EXCEL : Unhandled PTG 0x0.
formula data :  (shared)
       0 | 00 00 00 00 c0 18 00 XX XX XX XX XX XX XX XX XX | .......*********

(lt-gnumeric:20573): gnumeric:read_expr-WARNING **: A1 : Unknown Formula/Array

Comment 11 Morten Welinder 2008-01-31 03:01:43 UTC
Saving fixes.  Keeping open for issues in comment #10.
Comment 12 Valek Filippov 2011-08-05 23:53:11 UTC
No warnings.
A6 looks like gnumeric (combination of super/subscript and bold/italic).
Could be closed?
Comment 13 Jean Bréfort 2011-08-06 05:38:31 UTC
Hmm, the original file still has one issue, cell A2 contains "=A1" but nothing is displayed there until F9 is pressed.
Comment 14 Andreas J. Guelzow 2011-08-08 17:39:37 UTC
@Jean this looks like a problem with the file. If you recalculate and resave the file as xls, then opening the new file will show that cell content.
Comment 15 Jean Bréfort 2011-08-08 18:23:24 UTC
It doesn't for me
Comment 16 Andreas J. Guelzow 2011-08-08 19:12:54 UTC
Jean, did you "_recalculate_ and resave"?
Comment 17 Jean Bréfort 2011-08-08 19:21:23 UTC
Hmm, probably missed a step. Things seem to work.
Comment 18 Andreas J. Guelzow 2011-08-10 21:16:51 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.