From: Joseph M. Newcomer on
That's why I'd do some single-stepping to see if the low-level conversion is having a
problem. That would generate a very specific question which might generate an answer.
joe

On Wed, 13 Dec 2006 02:10:49 GMT, "Elan Magavi" <Elan(a)nomailnospam.com> wrote:

>
>"Joseph M. Newcomer" <newcomer(a)flounder.com> wrote in message
>news:l5jun2p1uke4jgmn97gtm1j8o27gh8ukum(a)4ax.com...
>> Yes, VS 2003 is also known as VS.NET 2003.
>>
>> When I had to use Unicode under VS6, to do floating conversions I had to
>> first convert the
>> text to ANSI, because there was no support for Unicode floating point to
>> double
>> conversion.
>> joe
>>
>
>
>The text is ANSI in this case. Sample files for the app. Values are
>representes at n.nnnnnnn where the decimal point is a period. . Germans
>trying to use them are having a problem where text to float conversions are
>truncating everything beyond the decimal point. I am muttling through the
>solution still...
>
Joseph M. Newcomer [MVP]
email: newcomer(a)flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
From: Elan Magavi on
Norbert

I wanted to make sure i thanked you for your response. Thanks. going
through it all now..

Elan.


"Norbert Unterberg" <nunterberg(a)newsgroups.nospam> wrote in message
news:OyBUZTjHHHA.3952(a)TK2MSFTNGP02.phx.gbl...
>
> I am German, so maybe I can help here a little bit.
>
>
> Elan Magavi schrieb:
>> I have been working with this app which allows users to type in a fixed
>> point value.. liike "1.045982"
>>
>> The files which are sent with the app as samples use a decimal, (English)
>> as the seperator. In Germany, it is a comma.
>>
>> I have used the GetNumberFormat api which will return that value as
>> 1,045982.
>>
>> That value is sent to a swscanf() like so
>>
>> swscanf(procStr,_T("%lf"),&dVal);
>
> Some general information about these functions and the German locales:
>
> * Code page and font settings have nothing to do with it. German uses the
> same windows character set and code page as the US version, as far as I
> know. It begins to get difficult if you move more to the east, there you
> get the eastern europe character sets. However, all characters that are
> used for number formatting are still the same (in the ASCII range).
>
> * GetNumberFormat() formats a numbers for sending them to the screen or to
> the printer to make it look nice. The output of GetNumberFormat can not be
> reliably parsed by any of the input functions, as far as I know of. The
> reason is that I don't know any input function that deals with the
> tousands separator or with a minus sign behind the number (-1245.6 could
> be displayed as "1.245,6-", depending on the language settings page in
> control panel.
> Even Excel does use the "nice" format for displaying the numbers in the
> data cells, but as soon as you edit a cell, you get the "simple" number
> format in the edit field.
>
> * So to send data to another application, you might better stick to the
> number formatting as done by the C/C++ runtime library. All the C/C++
> runtime library functions obey the number format set by the current
> locale. HOWEVER, that locale is not automatically set to the current
> user's locale. For compatibility reasons, C programms are set to the "C"
> locale by default. If your application is locale-aware, you need to tell
> the library with a call to the setlocale() function.
>
> To set the printf/scanf formating to use the user's locale, you need to
> set at least the LC_NUMERIC locale:
> _tsetlocale(LC_NUMERIC, _T(""));
>
> A call to
> _tsetlocale(LC_ALL, _T(""));
>
> sets all locale info to the user's default language, that includes string
> sorting, date/time formatting and character handling functions.
> Note that you can explicitly set the German locale with something like
> _tsetlocale(LC_NUMERIC, _T("deu"));
> on any language version of Windows.
>
> Changing the number formating with LC_NUMERIC to German only changes the
> "." to ",", so -1.2345 will be printed as "-1,2345".
>
>
> * Now you need to decide what output format you want to use for your
> files. It depends on what type of software will read the files.
> - The German version of Excel respects the user's locale, so it will read
> files with the German formatted numbers (1,23456).
> - On the other hand, most simple programs "hacked together" do not call
> setlocale(), so they need the American (international?) number format,
> i.e. in config files.
> - Well written programs that read numbers from the user or from a file
> ask the user if the number format is German or English, or try to
> auto-detect the number format.
>
> You see, there is no easy answer (as always)
>
> I hope I could help!
>
> Norbert Unterberg
>
>
> Norbert


From: Elan Magavi on

"Norbert Unterberg" <nunterberg(a)newsgroups.nospam> wrote in message
news:OyBUZTjHHHA.3952(a)TK2MSFTNGP02.phx.gbl...
>

> To set the printf/scanf formating to use the user's locale, you need to
> set at least the LC_NUMERIC locale:
> _tsetlocale(LC_NUMERIC, _T(""));
>
> A call to
> _tsetlocale(LC_ALL, _T(""));
>
> sets all locale info to the user's default language, that includes string
> sorting, date/time formatting and character handling functions.
> Note that you can explicitly set the German locale with something like
> _tsetlocale(LC_NUMERIC, _T("deu"));
> on any language version of Windows.
>

I am attempting to test this all now and I have a question.

I do have the call at the constuctor of my app

_tsetlocal(LC_ALL,_T("")):

But when the lcid is set like this:

LCID lcid = LOCALE_SYSTEM_DEFAULT;

Which in my case is 2048;

I am assuming that call on a machine in Germany would return the German ID?
0x407.

So I guess I am curious how to replicate the German machine here. I have
used the Control Panel | Regional and Language Options to set the "Standards
and Formats" to German.

Thanks




From: Elan Magavi on

"Elan Magavi" <Elan(a)nomailnospam.com> wrote in message
news:SIkgh.5874$Gr2.3736(a)newssvr21.news.prodigy.net...
>
> "Norbert Unterberg" <nunterberg(a)newsgroups.nospam> wrote in message
> news:OyBUZTjHHHA.3952(a)TK2MSFTNGP02.phx.gbl...
>>
>
>> To set the printf/scanf formating to use the user's locale, you need to
>> set at least the LC_NUMERIC locale:
>> _tsetlocale(LC_NUMERIC, _T(""));
>>
>> A call to
>> _tsetlocale(LC_ALL, _T(""));
>>
>> sets all locale info to the user's default language, that includes string
>> sorting, date/time formatting and character handling functions.
>> Note that you can explicitly set the German locale with something like
>> _tsetlocale(LC_NUMERIC, _T("deu"));
>> on any language version of Windows.
>>
>
> I am attempting to test this all now and I have a question.
>
> I do have the call at the constuctor of my app
>
> _tsetlocal(LC_ALL,_T("")):
>
> But when the lcid is set like this:
>
> LCID lcid = LOCALE_SYSTEM_DEFAULT;
>
> Which in my case is 2048;
>
> I am assuming that call on a machine in Germany would return the German
> ID? 0x407.
>
> So I guess I am curious how to replicate the German machine here. I have
> used the Control Panel | Regional and Language Options to set the
> "Standards and Formats" to German.
>
> Thanks
>


Adding to this.. it seems that setting the LCID using GetUserDefaultLCID()
on the machine I have set to German returns the proper value.(0x407)