GnuCash
Contact   Instructions
Bug 795614 - Unicode handling in amount fields [resubmission]
Summary: Unicode handling in amount fields [resubmission]
Status: RESOLVED NOTABUG
Alias: None
Product: GnuCash
Classification: Unclassified
Component: Register (show other bugs)
Version: 3.0
Hardware: Other Linux
: Normal minor
Target Milestone: future
Assignee: ui
QA Contact: ui
URL:
Whiteboard:
Keywords:
: 795613 (view as bug list)
Depends on:
Blocks:
 
Reported: 2018-04-27 15:16 EDT by Eric Siegerman
Modified: 2021-02-27 12:46 EST (History)
4 users (show)

See Also:


Attachments

Description Eric Siegerman 2018-04-27 15:16:43 EDT
[ This issue refers to two non-ASCII Unicode characters: U+E9
  (e-acute) and U+1F600 (grinning-face emoji).  Bugzilla accepts
  the former, but not the latter, so in the following, I've typed
  an ASCII "*" in place of the literal emoji character. ]


There is some inconsistency in the register's handling of (what I
believe to be) invalid input.  This isn't new; it's the same in
GNC 3.0 and 2.6.18.

in a text field (i've tested a txn's description and a split's
memo), both U+E9 ("é", e-acute) and U+1F600 (grinning-face emoji)
are accepted, displayed, and stored correctly as UTF-8 by the XML
back end.  OK so far.

But in a currency-amount field (I've tested specifically a
split's Debit field, and all of the following cases are described
in those terms):

        I type          Result
        ======          ======

        abcd<ENTER>     Each of these behaves like "0<WHICHEVER>":
	abcd<TAB>	  - Debit is set to zero
			      - N.B.: this clobbers the previous
				value; compare with "5a<TAB>"
				below
			  - Focus moves as appropriate for
			    <WHICHEVER>

        a5		Same as above

	5a<ENTER>	Nothing happens.  The Debit field
			containing "5a" remains focused, even
			after repeated <ENTER>s

	5a<TAB>		1. I get an error dialog: "An error
			   occurred while processing 5a."

			2. When I dismiss the dialog, GNC moves
			   focus to the Credit field, leaving the
			   "5a" in the Debit field (the latter is
			   very surprising; the former only
			   somewhat so)

			3. When I then <TAB> or <ENTER> out of
			   the Credit field, Debit reverts to its
			   previous value
			     - N.B.: This is unlike "abcd<TAB>"
			       which forces Debit to zero

An e-acute (U+E9) it treated like "5a" above:
        12é34<ENTER>    As for "5a<ENTER>" (except that the cursor
			jumps to just before the offending "é")

        12é34<TAB>      As for "5a<TAB>"

But the U+1F600 emoji is completely ignored: it isn't displayed,
and has no effect on the results:
	12*34<ENTER>	As if I'd typed "1234<WHICHEVER>"
	12*34<TAB>

All of those are invalid inputs for currency amounts, I presume,
so it's to be expected that GnuCash rejects them all.  The issue
is with the variety of forms that rejection takes.

Testing context:
  - Ubuntu 16.04
  - GNC 3.0 and GNC 2.6.18 (same results with both)
  - Xfce (not sure if that matters)
  - Locale-related bits of GNC's environment:
        LANG=en_US.UTF-8
        LANGUAGE=en_US
        LC_COLLATE=C
  - Autosplit Ledger mode in effect for the account in question

  - AFAIK, I'm using UTF-8 (not UTF-32 or the like).  In all of
    the above testing, non-ASCII characters were entered using
    the CTRL-SHIFT-U escape sequence, e.g.
        <CTRL><SHIFT>ue9<SPACE>
    for the "é"
Comment 1 Eric Siegerman 2018-04-27 15:23:16 EDT
*** Bug 795613 has been marked as a duplicate of this bug. ***
Comment 2 Wm 2019-04-02 05:18:17 EDT Comment hidden (offtopic)
Comment 3 John Ralls 2021-02-27 12:46:09 EST
This is by design.

The credit and debit fields accept formula input; the intent is that you can enter something like 5+7 and when you tab out GnuCash will parse the formula then compute the value and store it. If it can't parse the formula then it assumes that you've made a mistake and would like to edit your entry. It won't let you commit the transaction with an unparseable entry. Text is assumed to be a function name if it's followed with a '(' or a variable if not. In a scheduled transaction template the variable is set aside and you'll be asked for a value when the Since Last Run dialog converts the template into a real transaction; in the register there's no way to get a value so GnuCash plugs in 0.

So 'abcd' and 'a5' are parsed as variables and assigned a value 0. a5 and 12é34 are parsed as variable-number or number-variable-number with no operators separating the values. That's not computable so GnuCash puts up the error dialog and won't let you commit the transaction.

In future please use the mailing lists (see https://wiki.gnucash.org/wiki/Mailing_Lists) to ask support questions.

Note You need to log in before you can comment on or make changes to this bug.