UTF8UpperCase lazarus / 31-LCL ---------------------------------------------------------------------- Ocye · 2012-12-03 22:02 When I call UTF8UpperCase('ɑbɑri'); (pchar #201#145'b'#201#145'ri') any further action leads to external SIGSEV. I guess some pointer are faulty; e.g. OutCounter for "Final correction of the buffer size" is 9. If someone can confirm I'll post a bug report. Code: [Select]unit Unit1; {$mode objfpc}{$H+} interface uses   Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,   LCLProc; type   { TForm1 }   TForm1 = class(TForm)     Button1: TButton;     Memo1: TMemo;     procedure Button1Click(Sender: TObject);   private     { private declarations }   public     { public declarations }   end; var   Form1: TForm1; implementation {$R *.lfm} { TForm1 } procedure TForm1.Button1Click(Sender: TObject); begin   Caption:=UTF8UpperCase('ɑbɑri');   Memo1.Lines.Add(Caption); end; end. Lazarus 1.1 r39360M FPC 2.6.0 x86_64-linux-qt ---------------------------------------------------------------------- Bart · 2012-12-03 23:09 I can confirm. It seems that this happens when a char has an uppercase equivalent that is longer: #$C9#$91 -> #$E2#$B#$AD and apparently you need at least 2 of those: UTf8UpperCase(#$C9#$91) will not crash, Utf8UpperCase(#$C9#$91#$C9#$91) will. Bart ---------------------------------------------------------------------- Bart · 2012-12-03 23:33 Reported as issue #23428. Bart ---------------------------------------------------------------------- Ocye · 2012-12-04 00:12 Quote from: Bart on December 04, 2012, 12:33:27 amReported as issue #23428.Thank you! But is the resulting character still UTF8 with more than two bytes? Anyway, at least no sigsev should be thrown. ---------------------------------------------------------------------- Bart · 2012-12-04 10:25 Quote from: Ocye on December 04, 2012, 01:12:14 amThank you! But is the resulting character still UTF8 with more than two bytes? Yes, the upper of #201#145 (2 bytes) is #$E2#$B#$AD (3 bytes). Quote from: Ocye on December 04, 2012, 01:12:14 amAnyway, at least no sigsev should be thrown. I don't get a sigsev, it just crashes (the app vanishes) with the follwing message: Marked memory at $0023DBE8 invalid Wrong signature $7D64F58E instead of 4C796538 Also, this only happens when HeapTrace is enabled (option -gh). (Tested on Win7-64, Lazarus 1.1/Fpc 2.6.2r1 (32-bit)) Bart ---------------------------------------------------------------------- Bart · 2012-12-04 11:23 I posted a workaround in the bugtracker. Bart ---------------------------------------------------------------------- Ocye · 2012-12-06 19:09 Unfortunately the bug tracker didn't sent me an email. So I have to thank Felipe here. Great work! And thanks to you, Bart, for the management .