[fpc-pascal] Unicodestrings and Assign(File)
juergen.hestermann at gmx.de
Sat May 19 17:47:09 CEST 2012
Sven Barth schrieb:
> If you change do_open to support Unicode you should do this for the
other functions (e.g. write,
> read) as well so that only the *W functions are used for them.
I think read/write only work on the file handle and don't use the file name.
So no changes are needed here (I think).
But of course there are other functions that need changing, for example
> Also you need to keep in mind that do_open is used by platform
> so you would need to change the declarations/handling for all other
platforms as well.
Yes. It can be a can of worms. ;-)
Although, as said: Only very few functions realy act on the file name.
Most use the file handle only (which will not change).
> Also you need to change the declaration of Assign as this expects a
I think it should be declared as "UnicodeString" or "String" so that
other string types that
are handed over are converted automatically.
> Also I don't know whether the Unix users would be happy if we'd push
UnicodeString upon them or whether they'd prefer AnsiString(CP_UTF8).
Yes, this is a general question:
What kind of string type should be used within Free Pascal mainly?
I am not sure how this is all affected by
> In the end maybe it should be AnsiString(CP_UTF8) for Unix systems
> for Windows systems and AnsiString(CP_SCP) (the current string) for
the other systems,
> so especially the platform independant code needs to be adjusted to
support all three
> cases without problems (which might not need that much work in the
As far as I know currently all platforms share the same filerec/textrec
definitions (which is
an array of bytes now). If that is changed then it would be changed for
But it can be changed to generic string type too. I am not so sure what
means when the type differs from one platform to the other. For example,
I have to use a "pointer
to widestring" for CreateFileW for Windows. So I need to convert to a
null terminated widestring
from the existing string type and this conversion must work under all
More information about the fpc-pascal