[fpc-pascal] Unicode filenames

Graeme Geldenhuys graemeg.lists at gmail.com
Mon Jun 30 10:52:54 CEST 2008


2008/6/30 Vincent Snijders <vsnijders at quicknet.nl>:
>
> But for filenames in fpgFileExists?

Sorry, yes the previous code was for things like painting text.


Here is the code for fpgFileExists

// platform indepenent
function fpgFileExists(const FileName: TfpgString): Boolean;
begin
  Result := FileExists(fpgToOSEncoding(FileName));
end;


// GDI dependent
function fpgToOSEncoding(aString: TfpgString): string;
begin
  Result := Utf8ToAnsi(aString);
end;

function fpgFromOSEncoding(aString: string): TfpgString;
begin
  Result := AnsiToUtf8(aString);
end;


No idea if this is enough for all cases (I'm not a unicode guru), but
Vladimir (russian developer) reported that it works for him.


Regards,
 - Graeme -


_______________________________________________
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/



More information about the fpc-pascal mailing list