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 119040 - report title fails when title includes quotation mark
report title fails when title includes quotation mark
Status: RESOLVED FIXED
Product: GnuCash
Classification: Other
Component: Reports
git-master
Other Linux
: Normal normal
: ---
Assigned To: Chris Shoemaker
Chris Lyttle
Depends on: 340007 580350
Blocks:
 
 
Reported: 2003-08-03 22:01 UTC by Andrew Ziem
Modified: 2018-06-29 20:35 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Andrew Ziem 2003-08-03 22:01:59 UTC
I changed title of an expense bar report to include two quotation marks.  
Then, the report came out blank.   
 
libguppiuseful-CRITICAL **: file guppi-matrix.c: line 318 
(guppi_matrix_solve_with_fallback): assertion `guppi_matrix_is_square 
(m)' failed. 
libguppiplot-Message: layout failed 
 
I am using gnucash-1.8.1-2mdk.
Comment 1 Derek Atkins 2003-08-04 01:49:52 UTC
Interesting.  I have a bad feeling that this is a guppi bug, but it's
certainly reproducible.  I changed my report name to "test report"
(with the quotes) and it gave me the same output.

In the short term, may I suggest not putting quotes into your titles? ;)
Comment 2 Phil T. Rich 2004-07-14 21:21:14 UTC
This seems to only happen

(1) With Guppi reports (asset bar chart & pie charts confirmed).

(2) When the Report name *starts* with a double-quote mark.

Non-guppi reports seem unaffected. A workaround might be to use
TeX-style quotes: ``Title'', which appear much like double quotes.
Comment 3 Christian Stimming 2005-11-15 13:23:13 UTC
The upcoming gnucash-2.x will no longer use guppi but instead goffice. Does this
problem still occur with this? current SVN in
http://gnomesupport.org/wiki/index.php/GnuCashSvn
Comment 4 Chris Shoemaker 2006-03-27 16:31:58 UTC
Current SVN behavior is to ignore any portion of the title after the first appearance of a double-quote.  We still need to investigate whether this is GnuCash's fault or GOG's fault. 
Comment 5 David Hampton 2006-04-22 21:22:46 UTC
I do not see this problem with the latest svn.  I can change the name of a report to "test" (with the quotes) or "test?" (with or without the quotes) and the report title and contents are correct.
Comment 6 Chris Shoemaker 2006-04-22 22:29:42 UTC
Still a bug.  Note that "title of an expense bar report" isn't talking about the tab title, but the chart title.
Comment 7 David Hampton 2006-04-24 22:18:53 UTC
The missing header is an interaction of the way that tables are specified in html and the gtkhtml parser.  All barcharts and piecharts are specified with the <object> tag and a series of <param name="foo" value="bar"> tags.  If the report title is "foo" (without the quotes), when parameter line reaches the gtkhtml it looks like this:

  <param name=\"title\" value=\"foo\">

The gtkhtml parser looks for the space and the greater than sign to do its tokenizing, and it has a rudimentary understanding of quoting.  This parses as you would expect.  If however, you change the report title to "foo" (with the quotes), when parameter line reaches the gtkhtml it looks like this:

  <param name=\"title\" value=\"\" foo>

which is wrong, as the end quote has gone missing somewhere and a space has been added.  (As you can see below, it doesn't matter if this is fixed as the result will still be wrong.)  In this case the value for the title ends up being parsed as a null because the tokenizer finds an open quote, a close quote, and then a space which symbolizes the end of the token.  I've tried several variations of forcing the text passed into gtkhtml specific strings (e.g. <param name="title" value="\"foo\""> which looks correct to me) to no avail.  It always ended up munged by the time it reaches the gtkhtml parser and is parsing as something other than expected.  I also tried forcing the string to <param name="title" value="&quot;foo&quot;"> but the character entities are converted before the string reaches the html parser so the line looks like this:

  <param name=\"title\" value=\"\"foo\"\">

This actually parses correctly for a single word title, but fails miserably on a multi word title since the parser stops at the first space character.

In summary, I don't see a way to make gtkhtml display the quote character in the  output.  I can fix gnucash to remove quote characters before passing the title to gtkhtml so at least all the words in the title will be displayed.
Comment 8 Chris Shoemaker 2006-04-24 22:45:19 UTC
Sounds like we should do the best we can and then reassign the bug to gtkhtml - wouldn't be the first time.
Comment 9 Chris Shoemaker 2006-04-27 16:58:35 UTC
BTW, Andreas has fixed several bugs in gtkhtml, so maybe he wants to look at this, too.  (adding andi5 to cc)

Also, David, is there really no blame for gog here?
Comment 10 David Hampton 2006-04-27 18:24:05 UTC
As far as I can tell, no, there's no gog issue here.  The problem is in the way that charts are defined (an html object with the data in key/value pairs) and the gtkhtml parser.  The issue is how do you embed a quote into a quoted string and get it to parse properly.  The correct solution, afaict, is to enhance the gtkhtml parser to understand the backslash character and its traditional meaning of escaping the following character, so that if it sees something like this:

  value=\"\\\"foo\\\"\"

It should be parsed as a value of "foo" (with the quotes).
Comment 11 Andreas Köhler 2006-04-28 00:53:55 UTC
I do not see these backslashes, except in gdb which probably just prints them to distinguish these quotes with the quotes at the beginning and at the end of printed strings.

I think safest would be to escape &"<>' to &amp;&quot;&lt;&gt;&apos; within html-{barchart,piechart,scatter}.scm (in C you could use g_markup_escape_text) and unescape the title again in gnc-html-graph-gog.c:handle-{barchart,piechart,scatter}. For both actions I cannot see ready4use solutions, but implementation should not be too complex imho.

But maybe I cannot see the problem clear enough :)
Comment 12 David Hampton 2006-04-28 02:34:12 UTC
Doesn't work. By the time the text has been passed into the gtkhtml parser, the character entities have already been converted back to their single character representations.
Comment 13 Andreas Köhler 2006-04-28 09:29:35 UTC
Filed bug 340007 about it.
Comment 14 Phil Longstaff 2009-04-28 00:10:53 UTC
Not a problem on trunk (soon to be 2.3.x) using webkit.
Comment 15 John Ralls 2018-06-29 20:35:57 UTC
GnuCash bug tracking has moved to a new Bugzilla host. This bug has been copied to https://bugs.gnucash.org/show_bug.cgi?id=119040. Please update any external references or bookmarks.