[ic] Re: 4.9.4: [calc] and [currency] hosed - locale problem? [SOLVED]
Mike Heins
interchange-users@icdevgroup.org
Thu Jan 23 12:17:01 2003
Quoting Toni Mueller (support-ic@oeko.net):
>
>
> Hi,
>
>
> we had severe problems displaying the VAT correctly on our flypage,
> the result being ALWAYS wrong.
>
> Background information: With the constant changes in the legal
> settings here in Germany, there appear to be requirements to
> at least be able (afaik: MUST) show an item price net, the
> vat amount, and both added together (don't ask me why 8-( ).
> The legal rules on which to display, when, and what not to
> display seem to change on an almost weekly basis, but in order
> to avoid legal hassle, one has do adjust (or take the shop down).
>
> Anyway, we originally wanted to show "nicely" formatted prices
> in Euro according to our local tastes:
>
> Locale de_DE@euro
> Locale de_DE mon_decimal_point ,
> Locale de_DE mon_thousands_sep .
> Locale de_DE p_cs_precedes 0
> Locale de_DE currency_symbol " €"
>
> Unfortunately, this badly breaks [calc] and [currency] which are
> somehow evaluating their expressions as _strings_ in Perl, much
> like eval "stuff_inside_cal" (I didn't make too large inrods into
> Vend/Interpolate.pm to be 100% sure, though).
>
> With the settings above, you can say:
>
> [calc][item-price noformat][/calc] and get the part of the price
> that's _after_ the decimal point (really a comma), apparently
> since this is the last part of a Perl expression:
> [perl] 2, 3 [/perl] yields 3.
>
> The workaround was to forcefully reset all locale settings to C,
> but unfortunately the catalog required forcing decimal points
> and such, too, before it would obey:
>
> Locale C
> Locale C currency_symbol " €"
> Locale C mon_decimal_point .
> Locale C frac_digits 2
>
> which makes for a less-localized experience, but at least solved
> the numerical problems :-|
>
> It would be nice if someone in the know could take a look at this
> and suggest a solution, or a good place to start hacking. Thank
> you!
This is going to be fixed in 4.9.7 today -- I am taking on this
locale thing so that we don't have problems in 5.0. The problem is that
a persistent setlocale() call is being done when it should not be;
I will change this.
>
> This test was conducted with 4.9.6-something.
>
>
> Side question: Is it sensible to run 4.9.7 in production already?
>
If it isn't too critical. There is one major change to the output model,
but I haven't seen any reports of it causing problems so far.
--
Mike Heins
Perusion -- Expert Interchange Consulting http://www.perusion.com/
phone +1.513.523.7621 <mike@perusion.com>
Being against torture ought to be sort of a bipartisan thing.
-- Karl Lehenbauer