[fpc-devel] ThousandSeparator

Mattias Gaertner nc-gaertnma at netcologne.de
Thu Nov 27 12:09:08 CET 2014


On Tue, 25 Nov 2014 20:12:31 +0100 (CET)
marcov at stack.nl (Marco van de Voort) wrote:

> In our previous episode, Michael Van Canneyt said:
> > > The ThousandSeparator is "char" and supports only 1 byte characters.
> > > For example French and Russian need more.
> > > Are there any plans to extend it?
> > 
> > Plans: yes. Time: no.
> > 
> > Maybe a widechar is sufficient ? 
> 
> If you start changing the encoding of formatsettings (to something else than
> whatever "string" is, you get a lot of conversions. Even to just print a
> number you get thousandseparator (multiple times), decimal separator etc.
> 
> I think biting the bullet and making it a string is better long term. If we
> ever target a different "string" it will also break less code.

+1

Linux uses strings too.
With LC_NUMERIC=ru_RU.utf8 the thousand separator is the two byte
nbsp/160. French for some reason uses simple space.

BTW, the clocale unit, which sets the formatsettings, simply takes the
first byte. It would be good if it would check if the character is
ASCII. If not and codepage is utf8 then use the default. 
Should I create a patch for 2.8.0?

Hopefully in 2.8.1+ the type has changed and clocale can use the
correct settings.

Mattias



More information about the fpc-devel mailing list