Link to home
Start Free TrialLog in
Avatar of is-ol
is-ol

asked on

Running delphi program with different setting for number format

Hello, we have a Delphi Program (running under windows) that only runs correctly when the OS is set to english number format, i.e. the dot .  as decimal separator. As we are in Germany this means changing the number format every time.

I spent some time trying to convince delphi to use the dot regardless what locale is set but I could not get this working. Then I thought it might be possible to set environment variables before executing the program; I set LANG to "en" but this does not seem to influence the decimal separator. Is there another environment variable for this or another way to run a program with specific language/number settings?

Thank you for a hint,
jc
SOLUTION
Avatar of Thommy
Thommy
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Avatar of Sinisa Vuk
Sinisa Vuk
Flag of Croatia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of is-ol
is-ol

ASKER

Hi, thank you all, its not my own code ant it's ~ 10k lines.... I will try to determine where exactly the "wrong" conversion is being done and then get back here.
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of is-ol

ASKER

Thank you for the hints, unfortunately I could not yet check whether that helps as our internet connection broke down. I hope to finish that tomorrow. Regards,jc
Avatar of is-ol

ASKER

Yes, that seems to be the solution, now I started to use local FormatSettings and I can read in the data independent from the locale setting. Thank you very much!
May I ask why the B grade?
May I ask why I didn't get any points????
I was the first who suggested setting DecimalSeparator at runtime...
My hint stay the same. Always try to be independent regarding to a date/number format.
I you app will be international - you will have a problem.
Avatar of is-ol

ASKER

Sorry, PierreC, I did not use EX much up to now so I am not really familiar with the grades. I thought this is the normal grade for a "good" solution. Thommy, I tried your code but this did not work for me. I set the Decimal separator variable everywhere but only after using  local TFormatSettings in every format statement I got round the issue. Maybe that is due to the specific usage of string conversions in the code. Sinisav, the data in question is coming in from a SQL database with a fixed format. Naturally I only apply the local settings to these data, not to all other values that are and should be locale-dependent. Thank you all for helping!
You should have awarded an A grade.

Here are some guidelines for future reference:
http://support.experts-exchange.com/customer/portal/articles/481419
Avatar of is-ol

ASKER

Ok I see. Seems I cannot correct this now. I will heed to the guidelines in future, sorry.
No problem. At least you know for next time.
Avatar of is-ol

ASKER

Since an admin reopened the question I now tried to award points to all who helped. I award PierreC 210 pts as this code piece finally did the trick. Sorry for misinterpreting EE's grade system.