[fpc-pascal] Problem with string conversion

Jason P Sage jasonpsage at jegas.org
Fri Oct 20 16:39:48 CEST 2006

>> 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?

>Did you include cwstring as first unit in your project?

This question scares me a little because the Threading Applications require
you include them first... is this also true for Uni-Code Stuff? 

Does this possibly suggest Threaded Applications Using Uni-Code May be
problematic by chance?

Jason P Sage

More information about the fpc-pascal mailing list