[plt-scheme] Why do MzScheme ports not respect the locale's encoding by default?

From: Jens Axel Søgaard (jensaxel at soegaard.net)
Date: Fri Feb 18 17:16:57 EST 2005

Jim Blandy wrote:
> Alex Shinn <foof at synthcode.com> writes:
>>At 17 Feb 2005 17:17:37 -0500, Jim Blandy wrote:

>>>You're right that locale-sensitivity leads to all sorts of
>>>unpredictability and hidden portability issues.  

> The locale controls a bunch of different things, including sorting and
> collation rules, membership in <ctype.h> character classes (making
> those functions basically useless for parsing programs, argh), message
> catalogs (what you mentioned), and a bunch of other things.  

This reminds me of a bug I once discovered in a Windows program.

The program could save data to be used later. That worked like a charm.
The program were supposed to load the saved data. That didn't work.
Even trivial data would provoke an error when saved.

Curious I loaded the saved data with notepad. It all looked normal
the data consisted mostly of commma separated floating point values.

On a hunch I changed the language setting (in Windows - not in the program)
from Danish to American. Suddenly everything worked.

The problem were that we use comma to separate the integer part of a
number from the fractional part. The program probably used a normal
C routine to print the numbers getting output as 3.14 but the
reader was aware of the locale and were expecting 3,14 as input.

Since then I have been somewhat sceptically about automatic locale.

Jens Axel Søgaard

Posted on the users mailing list.