[fpc-devel] Re: Russian locale information not compatible with FPC locale variables

Graeme Geldenhuys graemeg.lists at gmail.com
Tue Jul 29 10:12:33 CEST 2008


On Tue, Jul 29, 2008 at 9:54 AM, Graeme Geldenhuys
<graemeg.lists at gmail.com> wrote:
> Hi,
>
> A Russian user raised the issue in the fpGUI newsgroups...  fpGUI uses
> UTF-8 as the internal string encoding. He noticed that the File Dialog
> which displays the file sizes with thousand separators were totally
> blank.  On further investigation he noticed that it was FormatFloat()
> that caused the issue. FormatFloat uses the ThousandSeparator locale
> variable.
>
> In FPC the ThousandSeparator is of type Char which can only hold one
> byte. Yet the Russian locale uses the non-breaking space character as
> expressed in UTF-8 as 'C2 A0' (bytes) and takes up 2 bytes.  So how do
> we assign the Russian ThousandSeparator (U+00A0) in FPC to the
> ThousandSeparator variable?


In fpGUI the rsThousandSeparator contains the locale specific
character in UTF-8 encoding.

Also ThousandSeparator := Utf8toAnsi(rsThousandSeparator) is not
compilable because Utf8ToAnsi() returns a string, not a Char. And
simply casting the result to a Char might not be a good idea in all
cases.

This issue obviously affects more that just the FormatFloat()
function. It affects any functions using FPC locale variables defined
as Char and the UTF8toAnsi() result is more that one byte.


Regards,
 - Graeme -


_______________________________________________
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/



More information about the fpc-devel mailing list