[fpc-pascal] locale solution for unix systems

Marco van de Voort marcov at stack.nl
Fri Mar 20 15:54:15 CET 2009

In our previous episode, Graeme Geldenhuys said:
> > Personally I would like to see the formatsettings being localised by
> > default (by SysUtils), since on Windows it is (Delphi compatibility)
> > and I'd expect it ot be the same on all platforms.
> > For this reason a "bulky read external" alternative might be useful if
> > we do not want SysUtils be dependent on libc.
> Exactly. It is currently very annoying that my Windows apps have
> correct locale settings and the exact same application under Linux
> doesn't. To resolve this, I had to build a config screen into my
> application where the user can specify correct formatting for various
> things.

Well, if you are so strung up on orthogonality, maybe we should move the
windows detection to clocale also :_)
> > In that case I'd opt for parsing the text-based versions, since the
> > compiled ones are libc dependent (their format changes).
> Seeing that correct locale information is totally missing on anything
> but Windows

Just include clocale.

> I don't see why we can't enable "correct" locale
> information on systems we can support via parsing text files for now.

Make a libc-free plugin unit, and it can be added as package. I see no
problem in that, as long as it is suitably multiplatform.
> And incrementally add support for other platforms like FreeBSD etc as
> we figure out what to do - without linking to libc.

No "other platforms" as afterthought please!

More information about the fpc-pascal mailing list