Hi everybody
I got a new laptop, and as you may image, i bought a MAC. As I wanted to port different of my Delphi/Lazarus applications, everything worked out fine, expect that the carbon interface did not return correct strings.
After a while, I found that the "CFStringToStr" function in the file "CarbonProc.pp" did not work as it should do. Being very frustrated, I replaced it with this code, which now works fine for my system (I didn't test yet on other ones ...).
function CFStringToStr(AString: CFStringRef): String;
var
Str: Pointer;
StrSize: CFIndex;
i:integer;
u:UniChar;
begin
if AString = nil then
begin
Result := '';
Exit;
end;
// init emtpy string
Result:='';
// get characters ...
for i:=0 to CFStringGetLength(AString)-1 do
begin
//... byte by byte ...
u:=CFStringGetCharacterAtIndex(AString,i);
// ... and at them to the result
Result:=Result+chr(u);
end;
// convert the entire result to ANSI
Result:=ansitoutf8(Result);
end;
I don't know if my system has a problem, or if I did any coding mistake. I did not find much about others having the same problem nor any solution. This is why I decided to post this message.
have a nice day