Re: Comma and full point decimal problems between languages



at begining of program: GetLocaleInfo to retrieve current separators
(decimal and thousand), then if necess. SetLocaleInfo to set the correct
separators
(in sdk api)



"Granty" <grant@xxxxxxxxxxx> a écrit dans le message de
news:aecf6bb5-eb7e-4b0c-aa67-696da070e031@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Hi All,

I have found similar posts to this one, but not one which nails my
particular problem.

I work in Spain but my PC is English/UK configured. When I deploy my
finished application other users with a Spanish (SP) configuration
experience a problem I don't get on my machine. Here is the scenario:

A real number is read from a database. This is then used in a
calculation. On Spanish based machines I get a floating point error. I
am assuming that this is to do with the locale as in the UK we use the
comma to separate thousands and a full point the decimal. In Spain
(and a lot of the continent) this is reversed:

UK: 12,189.20
SP: 12.189,20

The numbers being used here are not in string format (they are read
from the database independent of locale). It seems that the
application however ignores the locale settings of the PC and assumes
it to be using UK numbering format. At the point when it performs the
calculation it crashes with a floating point error.

Are there settings within Delphi which can be altered at run time to
handle this problem? I can possibly get around it by converting to
strings and playing around that way changing the separators and
decimal points but this seems like a lot of unnecessary messing about
and adds yet more unwanted coding.

Thanks.

Granty


.



Relevant Pages

  • Comma and full point decimal problems between languages
    ... I work in Spain but my PC is English/UK configured. ... The numbers being used here are not in string format (they are read ... from the database independent of locale). ... application however ignores the locale settings of the PC and assumes ...
    (alt.comp.lang.borland-delphi)
  • Re: ANNOUNCE: Tcl Plugin v3.1
    ... | On windows XPsp2. ... which changed our locale from 'C' to 'German'. ... Changing the systems locale settings is not really the trick of the ... In tcl 8.5 using the new library for bignums, ...
    (comp.lang.tcl)
  • Re: ANNOUNCE: Tcl Plugin v3.1
    ... My suggestion to change the locale settings was meant ... | got louder asking if tcl is the right programming language if it is ...
    (comp.lang.tcl)
  • Re: How to format textbox value before sum?
    ... decimal point for floating part: ... Unless one knows exactly in what locale the number is typed, ... Have separate "clean up" subs for different locales plus a sub to ... accept only this format (most forms are using 2dn approach so far ...
    (comp.lang.javascript)
  • locale help please
    ... I don't get locale setting done correctly. ... perl: warning: Setting locale failed. ... perl: warning: Please check that your locale settings: ... language-selector-common/dapper uptodate 0.1.20.1 ...
    (Ubuntu)