Zitat von Graeme Geldenhuys <[EMAIL PROTECTED]>:

> 2008/6/30 Vincent Snijders <[EMAIL PROTECTED]>:
> >
> > 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;

ok


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

Not ok.
UTF8ToAnsi converts to the current windows 8bit code page. Each code page only
supports a few languages, but not all. See:

http://www.microsoft.com/globaldev/reference/WinCP.mspx

As you can see, the 1250 is for whole central europe, so french, spanish,
german, english - they all use the same codepage.
Russian needs another.
And afaik chinese is converted to DBCS. (I did not try)


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

ok.
I wonder, what windows gives for characters not in the current code page.


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

Of course it works for him - MS keeps things going. As long as a user stays in
his code page it works.


Mattias

_______________________________________________
fpc-pascal maillist  -  [email protected]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to