GNOME Bugzilla – Bug 119040
report title fails when title includes quotation mark
Last modified: 2018-06-29 20:35:57 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.
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? ;)
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.
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
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.
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.
Still a bug. Note that "title of an expense bar report" isn't talking about the tab title, but the chart title.
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=""foo""> 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.
Sounds like we should do the best we can and then reassign the bug to gtkhtml - wouldn't be the first time.
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?
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).
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 &"<>' 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 :)
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.
Filed bug 340007 about it.
Not a problem on trunk (soon to be 2.3.x) using webkit.
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.