X
45 Rate this article:
No rating

INTERNAL: Decimal numbers in Europe are designated by a comma instead of a decimal point.

Anonym
Topic:
Decimal numbers in Europe are designated by a comma instead of a decimal point. In IDL 5.0 they were able to read decimals into idl that were delimited by commas...which is a characteristic way to represent decimals in Germany. In IDL 5.2 this no longer works. It interprets the comma as separating two separate numbers.Discussion:
Since IDL is not a localized application, it only deals with the standard IO API internally to handle file input and output. Any localization capabilities (such as using "," instead of "." for a float deliminator) is a side effect of the operating system and not a feature of IDL. As documented, IDL only officially supports ".".

It is unclear why the behavior changed between IDL 5.0 and 5.2 (5.1?), but no explicit changes were made for this behavior.

One thing that could be checked is the actual locale setting of IDL. The ANSI standard routine to control the locale (setlocale) could be used in a DLM to do this. I've appended the Windows example that actually sets the value to Germany. Also on Unix you can set enviroment variables to control the locale (LC_ALL for example), but I'm not sure on Windows. (For the Windows information on this see GENLANG154.

-KSolution:
/* LOCALE.C: Sets the current locale to "Germany" using the
* setlocale function and demonstrates its effect on the strftime
* function.
*/

#include <stdio.h>
#include <locale.h>
#include <time.h>

void main(void)
{
time_t ltime;
struct tm *thetime;
unsigned char str[100];

setlocale(LC_ALL, "German");
time (<ime);
thetime = gmtime(<ime);

/* %#x is the long date representation, appropriate to
* the current locale
*/
if (!strftime((char *)str, 100, "%#x",
(const struct tm *)thetime))
printf("strftime failed! ");
else
printf("In German locale, strftime returns '%s' ",
str);

/* Set the locale back to the default environment */
setlocale(LC_ALL, "C");
time (<ime);
thetime = gmtime(<ime);

if (!strftime((char *)str, 100, "%#x",
(const struct tm *)thetime))
printf("strftime failed! ");
else
printf("In 'C' locale, strftime returns '%s' ",
str);
}

/*
Output
In German locale, strftime
*/</time.h></locale.h></stdio.h>