[Lazarus] TProcess, UTF8, Windows

Mattias Gaertner nc-gaertnma at netcologne.de
Fri Apr 13 19:56:16 CEST 2012


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

> Mattias Gaertner schrieb:
>  >> 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.
> 
> ??? What defaults? The topic is string encoding not defaults.

All strings in the LCL are UTF-8 unless explicitly noted otherwise.
There are more defaults for example coordinate systems.

 
>  > Feel free to add the encoding to those functions you think it is not
>  > clear and send a patch.
> 
> I would like to. But how do I get the information? 

It's open source. You are a programmer. You have an IDE.
How do you think others are getting the information?


> You see the vicious circle?

Yes, but I hope others will not follow your example.


> Or do you mean I should find out the encoding by trial and error for 
> each function
> myself (bulding a test program around them) because this is the only way 
> to get it?
> Who wants to program with such a programming language where encoding for
> function parameters is not documented?
> It seems it's for the hard core developers only.
> 
> 
>  > A volunteer project like Lazarus requires the help of volunteers.
> 
> Yes. If you send me a list of the expected/used string encoding for *all*
> function parameters then I can add this information to the documentation
> when I find out how to do that. 

lol


> How can I change it here:
> http://lazarus-ccr.sourceforge.net/docs/lcl/fileutil/copyfile.html
> ?
> 
> 
>  >> 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?
> 
> Well, I was mainly talking about any string parameter to any function in
> any library that comes with Free Pascal and/or Lazarus and I was under the
> impression that Marco's problem was based on the same issue: A string 
> parameter
> is required ("Memo1.Lines.Append") but it is not clear what encoding is 
> expected.

Read his first mail again. He used ConsoleToUTF8, which is correct, if the process prints in console encoding. 


> This isssue exists for *all* functions of Free Pascal and Lazarus that 
> expect
> strings as parameters. I already mentioned the example of CopyFile:
> To my astonishment the function CopyFile not only exists in the unit 
> Windows (where
> I expected it) but also in the LCL (with different string encoding). The 
> same applies to
> FindFirst and other file functions.

Where do you see FindFirst with different encoding?


Mattias




More information about the Lazarus mailing list