[Lazarus] TProcess, UTF8, Windows

Mattias Gaertner nc-gaertnma at netcologne.de
Fri Apr 13 17:49:27 CEST 2012


On Fri, 13 Apr 2012 17:18:37 +0200
Jürgen Hestermann <juergen.hestermann at gmx.de> wrote:

> Lukasz Sokol schrieb:
>  >> IMO it must be possible to predict the encoding of strings
>  >> when writing the code (without running the program).

Marcos didn't wrote what program he called.
Maybe the output is not even text.


>  > No one prohibits you to use an identifier name to reflect encoding ;)
> 
> That's true and that's what I am doing of course.
> 
> But if you use a function from a (Free Pascal or Lazarus) library it is 
> not clear which kind of encoding this function expects. As I already 
> mentioned, for example CopyFile (from LCL) and FindFirst (from SysUtils) 
> have no hint in their documentation on what encoding is expected. I 
> know, somewhere it says that library x has enconding y but why wasn't 
> this information written to the documentation for the indiviudal 
> functions?

Normally defaults are not explained for every function of a
unit/package.
Feel free to add the encoding to those functions you think it is not
clear and send a patch.
 

> I don't get it. It's a very important information. I think 
> that many Free Pascal (and Lazarus) users come from other platforms like 
> Delphi, Virtual Pascal, Turbo Pascal etc. and many want to use parts of 
> their old code. These people do not sit down for months to find all the 
> spread information that *may* be important for FindFirst, CopyFile, etc. 
> They expect all releveant information at the docu for the functions.

A volunteer project like Lazarus requires the help of volunteers.


>  > Also : how do you think you'd guess encoding of a text file on disk
>  > before reading it ? Some people don't like to have the decision taken
>  > by the compiler for themselves...
> 
> That's not what we are talking about here. If I understood Marcos 
> problem correctly the topic was the output of another function where the 
> encoding was unclear.

What function are you talking? Have you read the example Marcos used?

 
>[...]
> As long as you *know* about each encoding you can manage it. But if you 
> have to guess the encoding then it will fail in general.

Yes.
I hope the Windows Codepages will eventually vanish.

 
>[...]

Mattias




More information about the Lazarus mailing list