[fpc-pascal] Problem with string conversion

Felipe Monteiro de Carvalho felipemonteiro.carvalho at gmail.com
Fri Oct 20 01:42:45 CEST 2006


Hello,

I am having a problem with string conversion from utf-8 to utf-16:

procedure TForm1.Button6Click(Sender: TObject);
var
  WideText: PWideChar;
  AText: string;
  Size: Integer;
begin
  AText := 'Meu longo texto iso-8859-1';
  Size := Utf8ToUnicode(nil, PChar(AText), 0);
  WideText := GetMem(Size);
  Utf8ToUnicode(WideText, PChar(AText), Size);
  FreeMem(WideText);
end;

When I execute this procedure above, I will get an error on the end of
the program:

External: Sigsegv

System_remove_from_list_fixed

any ideas?

thanks,
-- 
Felipe Monteiro de Carvalho



More information about the fpc-pascal mailing list