Re: Problem with locales



On Fri, 30 Jul 2004 17:18:57 +0200
Carlo Agrusti <carlo-ag libero it> wrote:

This could be normal if we consider that current locale is it_IT euro, 
which has as default "," as decimal separator; what I cannot understand 
is how "sscanf", which is a standard C function, can follow locale 
rules. The second aspect of this issue is that the same application 
doesn't show this behaviour under windows.

Any idea?

  Hi Carlo.

  Sscanf _does_ follow locales. I had that very nasty experience myself
not so long ago! I opted to make a small routine that scans the input
string, and replaces any ',' to a '.' or vice versa.

  This is very disturbing, as many programs generate numbers with '.' as
decimal separator, and the data cannot be imported into comma-oriented
country.

  Changing the locale solves that, but introduces _many_ other problems.
You can change the LC_NUMERIC part of the locale only, which is the best
solution if you don't want my solution (the routine above).

  John



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]