[Lazarus] TProcess, UTF8, Windows

Jürgen Hestermann juergen.hestermann at gmx.de
Fri Apr 13 17:52:23 CEST 2012


Felipe Monteiro de Carvalho schrieb:
 > It would be a huge duplication of documentation to write in every
 > single Lazarus function that uses string that it expects UTF-8.
 > It would be like writing in every function that string means
 > longstring (aka ansistring), that the routine is not using a
 > shortstring ... well, this is obvious.

Huh? Now I know why it is as it is.
How can you say that all this is obvious?
Why is it obvious that FindFirst expects ANSI enconding
while CopyFile needs UTF8. How should a programmer know this?
It does not fall from sky.

When I use a function that I used before (in Turbo Pascal, Virtual Pascal,
Delphi) but now want to use with Free Pascal (Lazarus) then the first
thing is to google for it. For CopyFile I find a link to the documentation
but it only says:

-----------------------------------
const SrcFilename: String;
const DestFilename: String

SrcFilename    The source filename for the Copy
DestFilename   The destination filename for the Copy
-----------------------------------

String is generic so it can be pchar, shortstring or ansistring or ....
But what is the encoding? It does not tell me. If the parameter I want
to feed in comes from a different source (database, file, ...) where I
know the encoding how do I find out to which encoding it has to be
converted to?






More information about the Lazarus mailing list