Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2008-11

UnicodeChar and Locale variables don't work

3 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Graeme Geldenhuys

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/

Reply by email

Florian Klaempfl
to Graeme Geldenhuys
Show quoted text 27 lines
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?

Well, this is one of the thousands of little problems which need to be solved ...

Reply by email