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 787572 - Currency symbol in the middle of number
Currency symbol in the middle of number
Status: RESOLVED NOTGNOME
Product: GnuCash
Classification: Other
Component: Currency and Commodity
2.6.17
Other Linux
: Normal critical
: ---
Assigned To: gnucash-core-maint
gnucash-core-maint
Depends on:
Blocks:
 
 
Reported: 2017-09-12 05:41 UTC by Hamid
Modified: 2018-06-29 23:59 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Currency symbol is showing inside the number (25.88 KB, application/pdf)
2017-09-12 05:41 UTC, Hamid
Details
Balance sheet exported as HTML. (5.73 KB, text/plain)
2017-09-22 20:35 UTC, John Ralls
Details
Screenshot of balancesheet.html rendered in Chrome. (57.76 KB, image/png)
2017-09-22 20:36 UTC, John Ralls
Details
balancesheet.html rendered in Firefox. (52.36 KB, image/png)
2017-09-22 20:37 UTC, John Ralls
Details
KDE system panel showing mix of different number shapes (32.07 KB, image/png)
2017-09-22 21:35 UTC, Hamid
Details

Description Hamid 2017-09-12 05:41:40 UTC
Created attachment 359572 [details]
Currency symbol is showing inside the number

Hello,

In reports the currency symbol shows up in the middle of number. I attach a sample balance sheet report.
Comment 1 John Ralls 2017-09-12 14:05:51 UTC
Cool. Looks like another currency showing bug 787749 too. What currency is it?

I'm not able to replicate the problem with USD and when I try with IRR no currency symbol shows up on the report.
Comment 2 Hamid 2017-09-14 17:07:42 UTC
Currently I am using GnuCash in Manjaro. Previously I used it in Ubuntu and it was the same. Possibly has to do with environment regional settings. I might have somewhere hinted that I am living in Iran and the system has set some adjustments.

Any information I can post?
Comment 3 John Ralls 2017-09-14 20:06:02 UTC
Yeah, what font are you using? I can't find one in Debian that will render the rial codepoint (u+fdfc).
Comment 4 Hamid 2017-09-16 19:28:05 UTC
I am using system fonts.
Comment 5 Frank H. Ellenberger 2017-09-16 20:38:55 UTC
It might vary with distribution, desktop environment, ...

Perhaps https://wiki.gnucash.org/wiki/FAQ#Q:_How_get_I_rid_of_strange_unreadable_characters_or_adjust_the_font_size can help you to get it's name?
Comment 6 John Ralls 2017-09-16 20:44:04 UTC
I've managed to reproduce it, having finally found a farsi font that displays the rial symbol. One must set "Region and Formats" to Iran in System Preferences>Language and Region. As Hamid noted it only affects reports. I haven't yet figured out whether it's WebKit's fault or something we're doing.
Comment 7 John Ralls 2017-09-16 21:28:54 UTC
Hamid, what are your locale settings?
Comment 8 Hamid 2017-09-17 02:21:50 UTC
LANG=en_US.utf8
LC_CTYPE="en_US.utf8"
LC_NUMERIC=fa_IR
LC_TIME=fa_IR
LC_COLLATE="en_US.utf8"
LC_MONETARY=fa_IR
LC_MESSAGES="en_US.utf8"
LC_PAPER=fa_IR
LC_NAME=fa_IR
LC_ADDRESS=fa_IR
LC_TELEPHONE=fa_IR
LC_MEASUREMENT=fa_IR
LC_IDENTIFICATION=fa_IR
LC_ALL=
Comment 9 John Ralls 2017-09-17 03:00:17 UTC
Hmm. As an exercise can you try running with LC_ALL=fa_IR.utf8? The simplest way is to start it from a terminal:
  LC_ALL=fa_IR.utf8

Frank's and my testing shows that this will still put the Rial symbol to the right of the left-most grouping. I want to make sure that's the case on your system as well.

When writing numbers in Farsi is it normal for the numbers to go left-to-right even though surrounding text is right-to-left?
Comment 10 Hamid 2017-09-17 17:37:54 UTC
LC_ALL=fa_IR.utf8 made no difference.

Persian text is a combination of RTL alpha and LTR numeric sequence of alphanumeric characters. In other words text direction naturally changes when numbers are involved but we consider the total text as RTL. As far as I know there are extra Unicode characters to mark portions of RTL and LTR words when combining numerical and non-numerical content in a word.

Just some information if relevant:
https://bugreports.qt.io/browse/QTBUG-58364
Special Non-Printing input characters are being rejected by Qt's text engine
Comment 11 John Ralls 2017-09-17 17:54:00 UTC
Interesting, thanks. And do you normally put the currency symbol on the right or left?
Comment 12 Hamid 2017-09-17 21:08:35 UTC
We put the currency symbol to the left of the number.
Comment 13 Frank H. Ellenberger 2017-09-18 00:38:28 UTC
I am wondering, we do not see this behavior when opening the file e.g. with LANG=ar_BH.utf8 or he_IL.utf8. Before I set both currencies to IRR to avoid the conversion to their currencies.

https://opensource.com/life/16/3/twisted-road-right-left-language-support shows in the sections 'Two languages together, Kumbaya' ff. what can happen mixing strong, weak and neutral types of LTR and RTL text.

We have a currency symbol (strong RTL) and a number (weak LTR).
I think, it is somehow related to "٬" as thousand delimiter. The other tested languages use normal commas. Probaly it is a stronger LTR or breaks in some other way the direction.

Re #c12: So, in RTL reading, it means behind the number?
Then the Zero values are wrong formated, too.
Comment 14 Hamid 2017-09-18 20:41:15 UTC
About zero values and formatting, correct. But sometimes in tabular style, currency symbols are aligned in a way to make it look nice or are factored in the column headings. Depends on how you formatted the mainstream currencies.
Comment 15 John Ralls 2017-09-22 20:35:52 UTC
Created attachment 360289 [details]
Balance sheet exported as HTML.
Comment 16 John Ralls 2017-09-22 20:36:40 UTC
Created attachment 360290 [details]
Screenshot of balancesheet.html rendered in Chrome.
Comment 17 John Ralls 2017-09-22 20:37:09 UTC
Created attachment 360291 [details]
balancesheet.html rendered in Firefox.
Comment 18 John Ralls 2017-09-22 20:54:40 UTC
It occurred to me that this might be a WebKit problem rather than a GnuCash one, so I exported the report in HTML and displayed it in Chrome (which uses the WebKit rendering engine) and Firefox (which doesn't). The results are attached and one can clearly see that Chrome does it wrong but Firefox does it right.

I've filed https://bugs.webkit.org/show_bug.cgi?id=177384 for you.
Comment 19 Hamid 2017-09-22 21:35:00 UTC
Created attachment 360295 [details]
KDE system panel showing mix of different number shapes

The time is 0:44 which is showing in Persian shape. Other numbers are showing in Western shape.
Comment 20 Hamid 2017-09-22 21:38:20 UTC
There is a catch: we are mixing locale details and it might not produce expected results. Numbers are in Latin script (0,1,2 ...) but the currency symbol is Persian. I have found that KDE provides better internationalization since sometimes even the time is output in Persian digits (the attachment for comment 19). Another example is Libreoffice which independent of system has an option to show digits in different forms (Arabic, Hindi - I know, the names are misleading). Is it possible to add such capabilities to GnuCash?
Comment 21 John Ralls 2017-09-22 21:42:01 UTC
(In reply to Hamid from comment #19)
> Created attachment 360295 [details]
> KDE system panel showing mix of different number shapes
> 
> The time is 0:44 which is showing in Persian shape. Other numbers are
> showing in Western shape.

What does that have to do with GnuCash?
Comment 22 John Ralls 2017-09-22 21:48:04 UTC
(In reply to Hamid from comment #20)
> There is a catch: we are mixing locale details and it might not produce
> expected results. Numbers are in Latin script (0,1,2 ...) but the currency
> symbol is Persian. I have found that KDE provides better
> internationalization since sometimes even the time is output in Persian
> digits (the attachment for comment 19). Another example is Libreoffice which
> independent of system has an option to show digits in different forms
> (Arabic, Hindi - I know, the names are misleading). Is it possible to add
> such capabilities to GnuCash?

Maybe someday. I'm pretty sure that would require that we switch to ICU for numeric formatting, which would be a bit of work and there's plenty ahead of it in the queue and very few developers.
Comment 23 John Ralls 2018-06-29 23:59:28 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=787572. Please update any external references or bookmarks.