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 556633 - Bad accounting formats when the currency symbol follows the amount
Bad accounting formats when the currency symbol follows the amount
Status: RESOLVED OBSOLETE
Product: libgoffice
Classification: Other
Component: General
0.7.x
Other All
: Normal normal
: ---
Assigned To: Jody Goldberg
Jody Goldberg
Depends on:
Blocks: 647218
 
 
Reported: 2008-10-16 20:20 UTC by andre brunet
Modified: 2018-05-22 13:01 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
patch to fix the problem (excluding changelog entries) (428 bytes, patch)
2008-10-17 03:33 UTC, Andreas J. Guelzow
none Details | Review
suggested solution for this problem (2.84 KB, patch)
2008-10-18 05:27 UTC, Andreas J. Guelzow
none Details | Review

Description andre brunet 2008-10-16 20:20:13 UTC
I used the icon (not the menu) to format a number like 1232,45 € (german localized gnome) in a selected cell but it looked like this:
1234,45       €
123,23        €
....
but it should look like this: 
      1234,45 €
       123,23 €
I did'nt find this in the reported bugs (I searched "currency")
Thank you very much for gnumeric.
Comment 1 Andreas J. Guelzow 2008-10-16 20:53:03 UTC
This is locale specific and seems to relate to the currency symbol following the value. (So it is not visible in C.)

I can confirm and replicate with both 1.8.3 and current svn.
Comment 2 Andreas J. Guelzow 2008-10-17 03:11:37 UTC
The format we are applying is obtained from goffice via 
 go_format_new_from_XL (go_format_builtins[GO_FORMAT_ACCOUNTING][2])
so we could send this bug report to them.
Comment 3 Andreas J. Guelzow 2008-10-17 03:22:22 UTC
Okay in goffice in the file
goffice/utils/formats.c
in the function
go_currency_date_format_init
we have:
	if (precedes) {
		post_rep = post = (char *)"";
		pre_rep = (char *)"* ";
		pre = g_strconcat ("\"", curr,
				   (space_sep ? "\" " : "\""), NULL);
	} else {
		pre_rep = pre = (char *)"";
		post_rep = (char *)"* ";
		post = g_strconcat ((space_sep ? " \"" : "\""),
				    curr, "\"", NULL);
	}
I am pretty sure that should be:
	if (precedes) {
		post_rep = post = (char *)"";
		pre_rep = (char *)"* ";
		pre = g_strconcat ("\"", curr,
				   (space_sep ? "\" " : "\""), NULL);
	} else {
		pre_rep = pre = (char *)"";
		post_rep = (char *)"";
		post = g_strconcat ((space_sep ? " \"" : "\""),
				    curr, "\"", NULL);
	}
Since there is no point in pushing the numbers to the left.
Comment 4 Andreas J. Guelzow 2008-10-17 03:33:31 UTC
Created attachment 120768 [details] [review]
patch to fix the problem (excluding changelog entries)
Comment 5 Morten Welinder 2008-10-17 16:38:27 UTC
When I switch XL to a German locale, it's currency button changes appearance
and now sets the format

_-* #.##0,00 €_-;-* #.##0,00 €_-;_-* "-"?? €_-;_-@_-

In US locale it sets the format

_($* #,##0.00_);_($* (#,##0.00);_($* "-"??_);_(@_)

So neither the existing nor the proposed case appears to do the right thing,
assuming MS' people are indeed following the right definition of "right
thing".
Comment 6 Andreas J. Guelzow 2008-10-17 16:44:21 UTC
If I read this right then in XL the accounting format in the German locale adds 2 dashes: one to the very right and one to the very left if compared to the proposed version. So the proposed version would be what one can do easily without major changes to current code. The other part can't be figured out from teh locale alone.
Comment 7 Morten Welinder 2008-10-17 17:17:25 UTC
Mostly right.

The minus on the right is invisible: _-
Comment 8 Andreas J. Guelzow 2008-10-17 18:24:35 UTC
and for non-negative values the minus on the left luckily is also invisible. Next to "* " it so only has the effect to line things up correctly.

somehow I have the feeling that this may just need to be a translatable string...
Comment 9 Andreas J. Guelzow 2008-10-18 04:08:25 UTC
Looking at lconv all the information is there. The only problem is that a proper implementation should change  go_locale_get_currency since we need more arguments added to it. go_locale_get_currency is public so this would imply an api change.
Comment 10 Andreas J. Guelzow 2008-10-18 05:27:56 UTC
Created attachment 120821 [details] [review]
suggested solution for this problem

This patch only changes fmt_accounting[0] and [2]. Beforeapplying we would need to do the same for fmt_accounting[1] and [4] as well as all fmt_currency. 

The current formats are very north-america centric and assumes parentheses to indicate negative values.
Comment 11 Morten Welinder 2008-10-20 14:22:08 UTC
That patch really needs a

#define UNICODE_MINUS_S "\xe2\x88\x92"

Apart from that, we can can the api of go_locale_get_currency if we need
to in 0.7, but we might as well define a new function that provides more
information.  go_locale_get_currency could then be a simple wrapper.
Comment 12 Morten Welinder 2008-11-09 02:25:02 UTC
Actually, why are we putting unicode minuses into format strings?
It will not affect what we see on screen, and could break anyone
what asks for the rendered string.
Comment 13 Andreas J. Guelzow 2008-11-09 02:50:15 UTC
What do you mean with "it will not affect what we see on screen"?

If we put ascii-hyphens in the format string then they will show as ascii hyphen on screen and that differs from the unicode minus that is used, for example, by the General format.
Comment 14 Andreas J. Guelzow 2008-11-09 03:10:55 UTC
We know:

US:     _($* #,##0.00_);_($* (#,##0.00);_($* "-"??_);_(@_)
German: _-* #.##0,00 €_-;-* #.##0,00 €_-;_-* "-"?? €_-;_-@_-

We also need to know as what XL "translates" the following US strings:

US:    _($* #,##0_);_($* (#,##0);_($* \"-\"_);_(@_)
US:    _(* #,##0_);_(* (#,##0);_(* \"-\"_);_(@_)
US:    _(* #,##0.00_);_(* (#,##0.00);_(* \"-\"??_);_(@_)

While I have ideas what that could be, I have no way checking.

Comment 15 Morten Welinder 2009-05-28 19:00:51 UTC
The code has been rewritten to use the new generators.  That doesn't actually
fix any of the observed problems here, but now it's only wrong in one place.

I don't think localeconv's information is useful for us.  For one thing,
it says to use "-" for en_US -- we really want the parentheses.
For another it clearly isn't debugged much -- look at ur_PK to see a
very weird situation.

C: p_sign_posn=127  sign=   n_sign_posn=127  sign=
aa_DJ.utf8: p_sign_posn=1  sign=   n_sign_posn=1  sign=-
aa_ER.utf8: p_sign_posn=1  sign=   n_sign_posn=1  sign=-
aa_ET.utf8: p_sign_posn=1  sign=   n_sign_posn=1  sign=-
af_ZA.utf8: p_sign_posn=1  sign=   n_sign_posn=1  sign=-
am_ET.utf8: p_sign_posn=1  sign=   n_sign_posn=1  sign=-
an_ES.utf8: p_sign_posn=1  sign=   n_sign_posn=1  sign=-
ar_AE.utf8: p_sign_posn=1  sign=   n_sign_posn=2  sign=-
ar_BH.utf8: p_sign_posn=1  sign=   n_sign_posn=2  sign=-
ar_DZ.utf8: p_sign_posn=1  sign=   n_sign_posn=2  sign=-
ar_EG.utf8: p_sign_posn=1  sign=   n_sign_posn=2  sign=-
ar_IN.utf8: p_sign_posn=1  sign=   n_sign_posn=1  sign=-
ar_IQ.utf8: p_sign_posn=1  sign=   n_sign_posn=2  sign=-
ar_JO.utf8: p_sign_posn=1  sign=   n_sign_posn=2  sign=-
ar_KW.utf8: p_sign_posn=1  sign=   n_sign_posn=2  sign=-
ar_LB.utf8: p_sign_posn=1  sign=   n_sign_posn=2  sign=-
ar_LY.utf8: p_sign_posn=1  sign=   n_sign_posn=2  sign=-
ar_MA.utf8: p_sign_posn=1  sign=   n_sign_posn=2  sign=-
ar_OM.utf8: p_sign_posn=1  sign=   n_sign_posn=2  sign=-
ar_QA.utf8: p_sign_posn=1  sign=   n_sign_posn=2  sign=-
ar_SA.utf8: p_sign_posn=1  sign=   n_sign_posn=1  sign=-
ar_SD.utf8: p_sign_posn=1  sign=   n_sign_posn=2  sign=-
ar_SY.utf8: p_sign_posn=1  sign=   n_sign_posn=2  sign=-
ar_TN.utf8: p_sign_posn=1  sign=   n_sign_posn=2  sign=-
ar_YE.utf8: p_sign_posn=1  sign=   n_sign_posn=2  sign=-
as_IN.utf8: p_sign_posn=1  sign=   n_sign_posn=1  sign=-
ast_ES.utf8: p_sign_posn=1  sign=   n_sign_posn=1  sign=-
az_AZ.utf8: p_sign_posn=1  sign=   n_sign_posn=1  sign=-
be_BY.utf8: p_sign_posn=1  sign=   n_sign_posn=1  sign=-
bg_BG.utf8: p_sign_posn=1  sign=   n_sign_posn=1  sign=-
bn_BD.utf8: p_sign_posn=1  sign=   n_sign_posn=1  sign=-
bn_IN.utf8: p_sign_posn=1  sign=   n_sign_posn=1  sign=-
br_FR.utf8: p_sign_posn=1  sign=   n_sign_posn=1  sign=-
bs_BA.utf8: p_sign_posn=1  sign=   n_sign_posn=1  sign=-
byn_ER.utf8: p_sign_posn=1  sign=   n_sign_posn=1  sign=-
ca_AD.utf8: p_sign_posn=1  sign=   n_sign_posn=1  sign=-
ca_ES.utf8: p_sign_posn=1  sign=   n_sign_posn=1  sign=-
ca_FR.utf8: p_sign_posn=1  sign=   n_sign_posn=1  sign=-
ca_IT.utf8: p_sign_posn=1  sign=   n_sign_posn=1  sign=-
cs_CZ.utf8: p_sign_posn=1  sign=   n_sign_posn=1  sign=-
cy_GB.utf8: p_sign_posn=1  sign=   n_sign_posn=1  sign=-
da_DK.utf8: p_sign_posn=4  sign=   n_sign_posn=4  sign=-
de_AT.utf8: p_sign_posn=1  sign=   n_sign_posn=1  sign=-
de_BE.utf8: p_sign_posn=4  sign=   n_sign_posn=4  sign=-
de_CH.utf8: p_sign_posn=4  sign=   n_sign_posn=4  sign=-
de_DE.utf8: p_sign_posn=1  sign=   n_sign_posn=1  sign=-
de_LU.utf8: p_sign_posn=4  sign=   n_sign_posn=4  sign=-
el_CY.utf8: p_sign_posn=1  sign=   n_sign_posn=1  sign=-
el_GR.utf8: p_sign_posn=1  sign=   n_sign_posn=1  sign=-
en_AU.utf8: p_sign_posn=1  sign=   n_sign_posn=1  sign=-
en_BE.utf8: p_sign_posn=1  sign=   n_sign_posn=1  sign=-
en_BW.utf8: p_sign_posn=1  sign=   n_sign_posn=1  sign=-
en_CA.utf8: p_sign_posn=1  sign=   n_sign_posn=1  sign=-
en_DK.utf8: p_sign_posn=1  sign=   n_sign_posn=1  sign=-
en_GB.utf8: p_sign_posn=1  sign=   n_sign_posn=1  sign=-
en_HK.utf8: p_sign_posn=1  sign=   n_sign_posn=0  sign=-
en_IE.utf8: p_sign_posn=1  sign=   n_sign_posn=1  sign=-
en_IN.utf8: p_sign_posn=1  sign=   n_sign_posn=1  sign=-
en_NZ.utf8: p_sign_posn=1  sign=   n_sign_posn=1  sign=-
en_PH.utf8: p_sign_posn=1  sign=   n_sign_posn=0  sign=-
en_SG.utf8: p_sign_posn=1  sign=   n_sign_posn=0  sign=-
en_US.utf8: p_sign_posn=1  sign=   n_sign_posn=1  sign=-
en_ZA.utf8: p_sign_posn=1  sign=   n_sign_posn=1  sign=-
en_ZW.utf8: p_sign_posn=1  sign=   n_sign_posn=1  sign=-
es_AR.utf8: p_sign_posn=1  sign=   n_sign_posn=1  sign=-
es_BO.utf8: p_sign_posn=1  sign=   n_sign_posn=1  sign=-
es_CL.utf8: p_sign_posn=1  sign=   n_sign_posn=1  sign=-
es_CO.utf8: p_sign_posn=1  sign=   n_sign_posn=1  sign=-
es_CR.utf8: p_sign_posn=1  sign=   n_sign_posn=1  sign=-
es_DO.utf8: p_sign_posn=1  sign=   n_sign_posn=1  sign=-
es_EC.utf8: p_sign_posn=1  sign=   n_sign_posn=1  sign=-
es_ES.utf8: p_sign_posn=1  sign=   n_sign_posn=1  sign=-
es_GT.utf8: p_sign_posn=1  sign=   n_sign_posn=1  sign=-
es_HN.utf8: p_sign_posn=1  sign=   n_sign_posn=1  sign=-
es_MX.utf8: p_sign_posn=1  sign=   n_sign_posn=1  sign=-
es_NI.utf8: p_sign_posn=1  sign=   n_sign_posn=1  sign=-
es_PA.utf8: p_sign_posn=1  sign=   n_sign_posn=1  sign=-
es_PE.utf8: p_sign_posn=1  sign=   n_sign_posn=1  sign=-
es_PR.utf8: p_sign_posn=1  sign=   n_sign_posn=1  sign=-
es_PY.utf8: p_sign_posn=1  sign=   n_sign_posn=1  sign=-
es_SV.utf8: p_sign_posn=1  sign=   n_sign_posn=1  sign=-
es_US.utf8: p_sign_posn=1  sign=   n_sign_posn=1  sign=-
es_UY.utf8: p_sign_posn=1  sign=   n_sign_posn=1  sign=-
es_VE.utf8: p_sign_posn=1  sign=   n_sign_posn=1  sign=-
et_EE.utf8: p_sign_posn=1  sign=   n_sign_posn=1  sign=-
eu_ES.utf8: p_sign_posn=1  sign=   n_sign_posn=1  sign=-
fa_IR.utf8: p_sign_posn=1  sign=   n_sign_posn=1  sign=-
fi_FI.utf8: p_sign_posn=1  sign=   n_sign_posn=1  sign=-
fo_FO.utf8: p_sign_posn=4  sign=   n_sign_posn=4  sign=-
fr_BE.utf8: p_sign_posn=1  sign=   n_sign_posn=1  sign=-
fr_CA.utf8: p_sign_posn=1  sign=   n_sign_posn=0  sign=-
fr_CH.utf8: p_sign_posn=4  sign=   n_sign_posn=4  sign=-
fr_FR.utf8: p_sign_posn=1  sign=   n_sign_posn=1  sign=-
fr_LU.utf8: p_sign_posn=1  sign=   n_sign_posn=1  sign=-
ga_IE.utf8: p_sign_posn=1  sign=   n_sign_posn=1  sign=-
gd_GB.utf8: p_sign_posn=1  sign=   n_sign_posn=1  sign=-
gl_ES.utf8: p_sign_posn=1  sign=   n_sign_posn=1  sign=-
gv_GB.utf8: p_sign_posn=1  sign=   n_sign_posn=1  sign=-
he_IL.utf8: p_sign_posn=2  sign=   n_sign_posn=2  sign=-
hi_IN.utf8: p_sign_posn=1  sign=   n_sign_posn=1  sign=-
hr_HR.utf8: p_sign_posn=1  sign=   n_sign_posn=1  sign=-
hsb_DE.utf8: p_sign_posn=1  sign=   n_sign_posn=1  sign=-
hu_HU.utf8: p_sign_posn=1  sign=   n_sign_posn=1  sign=-
id_ID.utf8: p_sign_posn=1  sign=   n_sign_posn=1  sign=-
is_IS.utf8: p_sign_posn=1  sign=   n_sign_posn=1  sign=-
it_CH.utf8: p_sign_posn=4  sign=   n_sign_posn=4  sign=-
it_IT.utf8: p_sign_posn=1  sign=   n_sign_posn=1  sign=-
iw_IL.utf8: p_sign_posn=2  sign=   n_sign_posn=2  sign=-
ja_JP.utf8: p_sign_posn=4  sign=   n_sign_posn=4  sign=-
ka_GE.utf8: p_sign_posn=1  sign=   n_sign_posn=1  sign=-
kk_KZ.utf8: p_sign_posn=1  sign=   n_sign_posn=1  sign=-
kl_GL.utf8: p_sign_posn=4  sign=   n_sign_posn=4  sign=-
ko_KR.utf8: p_sign_posn=1  sign=   n_sign_posn=4  sign=-
ku_TR.utf8: p_sign_posn=1  sign=   n_sign_posn=1  sign=-
kw_GB.utf8: p_sign_posn=1  sign=   n_sign_posn=1  sign=-
lg_UG.utf8: p_sign_posn=1  sign=   n_sign_posn=1  sign=-
lt_LT.utf8: p_sign_posn=1  sign=   n_sign_posn=1  sign=-
lv_LV.utf8: p_sign_posn=3  sign=   n_sign_posn=3  sign=-
mg_MG.utf8: p_sign_posn=1  sign=   n_sign_posn=1  sign=-
mi_NZ.utf8: p_sign_posn=1  sign=   n_sign_posn=1  sign=-
mk_MK.utf8: p_sign_posn=1  sign=   n_sign_posn=1  sign=-
ml_IN.utf8: p_sign_posn=1  sign=   n_sign_posn=1  sign=-
mn_MN.utf8: p_sign_posn=1  sign=   n_sign_posn=1  sign=-
mr_IN.utf8: p_sign_posn=1  sign=   n_sign_posn=1  sign=-
ms_MY.utf8: p_sign_posn=1  sign=   n_sign_posn=0  sign=-
mt_MT.utf8: p_sign_posn=1  sign=   n_sign_posn=0  sign=-
nb_NO.utf8: p_sign_posn=4  sign=   n_sign_posn=4  sign=-
ne_NP.utf8: p_sign_posn=1  sign=   n_sign_posn=1  sign=-
nl_BE.utf8: p_sign_posn=1  sign=   n_sign_posn=1  sign=-
nl_NL.utf8: p_sign_posn=1  sign=   n_sign_posn=2  sign=-
nn_NO.utf8: p_sign_posn=1  sign=   n_sign_posn=3  sign=-
no_NO.utf8: p_sign_posn=4  sign=   n_sign_posn=4  sign=-
oc_FR.utf8: p_sign_posn=1  sign=   n_sign_posn=1  sign=-
om_ET.utf8: p_sign_posn=1  sign=   n_sign_posn=1  sign=-
om_KE.utf8: p_sign_posn=1  sign=   n_sign_posn=1  sign=-
pa_IN.utf8: p_sign_posn=1  sign=   n_sign_posn=1  sign=-
pl_PL.utf8: p_sign_posn=1  sign=   n_sign_posn=1  sign=-
pt_BR.utf8: p_sign_posn=1  sign=   n_sign_posn=1  sign=-
pt_PT.utf8: p_sign_posn=1  sign=   n_sign_posn=1  sign=-
ro_RO.utf8: p_sign_posn=1  sign=   n_sign_posn=1  sign=-
ru_RU.utf8: p_sign_posn=1  sign=   n_sign_posn=1  sign=-
ru_UA.utf8: p_sign_posn=1  sign=   n_sign_posn=1  sign=-
se_NO.utf8: p_sign_posn=4  sign=   n_sign_posn=4  sign=-
sh_YU.utf8: p_sign_posn=1  sign=   n_sign_posn=1  sign=-
sid_ET.utf8: p_sign_posn=1  sign=   n_sign_posn=1  sign=-
sk_SK.utf8: p_sign_posn=1  sign=   n_sign_posn=1  sign=-
sl_SI.utf8: p_sign_posn=1  sign=   n_sign_posn=1  sign=-
so_DJ.utf8: p_sign_posn=1  sign=   n_sign_posn=1  sign=-
so_ET.utf8: p_sign_posn=1  sign=   n_sign_posn=1  sign=-
so_KE.utf8: p_sign_posn=1  sign=   n_sign_posn=1  sign=-
so_SO.utf8: p_sign_posn=1  sign=   n_sign_posn=1  sign=-
sq_AL.utf8: p_sign_posn=1  sign=   n_sign_posn=1  sign=-
st_ZA.utf8: p_sign_posn=1  sign=   n_sign_posn=1  sign=-
sv_FI.utf8: p_sign_posn=1  sign=   n_sign_posn=1  sign=-
sv_SE.utf8: p_sign_posn=1  sign=   n_sign_posn=1  sign=-
ta_IN.utf8: p_sign_posn=1  sign=   n_sign_posn=1  sign=-
te_IN.utf8: p_sign_posn=1  sign=   n_sign_posn=1  sign=-
tg_TJ.utf8: p_sign_posn=1  sign=   n_sign_posn=1  sign=-
th_TH.utf8: p_sign_posn=4  sign=   n_sign_posn=4  sign=-
ti_ER.utf8: p_sign_posn=1  sign=   n_sign_posn=1  sign=-
ti_ET.utf8: p_sign_posn=1  sign=   n_sign_posn=1  sign=-
tig_ER.utf8: p_sign_posn=1  sign=   n_sign_posn=1  sign=-
tl_PH.utf8: p_sign_posn=1  sign=   n_sign_posn=1  sign=-
tr_CY.utf8: p_sign_posn=1  sign=   n_sign_posn=1  sign=-
tr_TR.utf8: p_sign_posn=1  sign=   n_sign_posn=1  sign=-
tt_RU.utf8: p_sign_posn=1  sign=   n_sign_posn=1  sign=-
uk_UA.utf8: p_sign_posn=1  sign=   n_sign_posn=1  sign=-
ur_PK.utf8: p_sign_posn=2  sign=   n_sign_posn=1  sign=-
wa_BE.utf8: p_sign_posn=1  sign=   n_sign_posn=1  sign=-
xh_ZA.utf8: p_sign_posn=1  sign=   n_sign_posn=1  sign=-
yi_US.utf8: p_sign_posn=2  sign=   n_sign_posn=2  sign=-
zh_CN.utf8: p_sign_posn=4  sign=   n_sign_posn=4  sign=-
zh_HK.utf8: p_sign_posn=1  sign=   n_sign_posn=0  sign=-
zh_SG.utf8: p_sign_posn=1  sign=   n_sign_posn=0  sign=-
zh_TW.utf8: p_sign_posn=1  sign=   n_sign_posn=1  sign=-
zu_ZA.utf8: p_sign_posn=1  sign=   n_sign_posn=1  sign=-
Comment 16 Andreas J. Guelzow 2011-08-23 22:40:48 UTC
Since we were talking about an API change here we should fix this while we can break API.
Comment 17 Andreas J. Guelzow 2011-08-23 22:50:56 UTC
ur_PK.utf8: p_sign_posn=2  sign=   n_sign_posn=1  sign=-

since there is no sign used for positive values, the position of that no sign shouldn't really matter.
Comment 18 GNOME Infrastructure Team 2018-05-22 13:01:53 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to GNOME's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/goffice/issues/15.