[fpc-devel] UnicodeChar and Locale variables don't work

Graeme Geldenhuys graemeg.lists at gmail.com
Thu Nov 20 15:39:30 CET 2008


Hi

How am I supposed to handle unicode characters for locale variables?
All locale variables like ThousandSeparator is type Char and there is
no overloaded UnicodeChar versions.  This causes problems in Russian
locales as the example below shows.


  c := UnicodeChar($00A0);  // non-breaking space character
  ThousandSeparator := c;

  s := Format('%10.2n', [123456789.123456]);
  writeln('Russian style No-break Space char  s = ', s);

  writeln('SizeOf(UnicodeChar) = ', SizeOf(c));
  writeln('SizeOf(ThousandSeparator) = ', SizeOf(ThousandSeparator));


And the output is as follows:

Russian style No-break Space char  s = 123�456�789.12
SizeOf(UnicodeChar) = 2
SizeOf(ThousandSeparator) = 1


The ThousandSeparater variable is not big enough to store the
character.  Plus, what's going to happen with > BMP characters?


Regards,
  - Graeme -


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


More information about the fpc-devel mailing list