Recent

Author Topic: Wrong month name convertion from DefautFormatSettings in LCL under Linux  (Read 1187 times)

mig-31

  • Sr. Member
  • ****
  • Posts: 305
Hi,

it is probably bug in LCL or I'm something missing.

Lazarus 1.6.4
FPC 3.0.2
CentOS 7 64-bit
Widget Qt4, GTK2
System Locale: LANG=cs_CZ.utf8

Code: Pascal  [Select][+][-]
  1.    procedure TForm1.Button1Click(Sender: TObject);
  2. const
  3.   NinthMonthName:string = 'září';
  4. begin
  5.   Edit1.Text:= DefaultFormatSettings.LongMonthNames[9]+' Length '+IntToStr(Length(DefaultFormatSettings.LongMonthNames[9]));
  6.   Edit2.Text:= NinthMonthName+' Length '+IntToStr(Length(NinthMonthName));
  7. end;  
  8.  

Return
Code: Pascal  [Select][+][-]
  1. z???. String length: 4
  2. září.String length 7
  3.  

But in terminal application it works correctly
Code: Pascal  [Select][+][-]
  1. program project1;
  2.  
  3. {$mode objfpc}{$H+}
  4.  
  5. uses
  6.   {$IFDEF UNIX}{$IFDEF UseCThreads}
  7.   cthreads,
  8.   {$ENDIF}{$ENDIF}
  9.   Classes,SysUtils,clocale
  10.   { you can add units after this };
  11. const
  12.   NinthMonth:string = 'září';
  13. begin
  14.   writeln('9-th month from const: ',NinthMonth, ' .String length ',Length(NinthMonth));
  15.   writeln('9-th month from DefaultFormatSettings: ',DefaultFormatSettings.LongMonthNames[9],'. String length ',Length(DefaultFormatSettings.LongMonthNames[9]));
  16. end.      
  17.  

Return
Code: Pascal  [Select][+][-]
  1. 9-th month from const: září .String length 7
  2. 9-th month from DefaultFormatSettings: září. String length 7
  3.  
Lazarus 2.2.6 - OpenSuse Leap 15.4, Mageia 8, CentOS 7

 

TinyPortal © 2005-2018