[fpc-pascal] Executing external processes and codepages

Jonas Maebe jonas.maebe at elis.ugent.be
Wed May 11 13:34:45 CEST 2016


Michael Van Canneyt wrote on Wed, 11 May 2016:

> On Wed, 11 May 2016, Jonas Maebe wrote:
>
>>
>> Michael Van Canneyt wrote on Wed, 11 May 2016:
>>
>>> And in the case it makes an assumption of the code page, regardless of
>>> environment variables ?
>>>
>>> (don't say that doesn't happen. It does, I know a programmer that does so)
>>
>> The caller can work around such bugs by either
>> a) using the pchar version of fpexec, or
>> b) specifying the code page that this target program uses in the  
>> environment used to invoke it
>
> a) obviously
> b) As said, the target program completely ignores the environment.

b) is exactly why you have to specify the code page that this *target  
program* uses in the environment when executing it, so that the  
invoking FPC program will convert the parameters to this code page.

> I was just trying to point out that while your solution is  
> undoubtedly correct
> in the large majority of cases (let's assume 99,99%), it is not a  
> rock-hard guarantee.

I never claimed it was. I only said it is the only possible correct  
behaviour. It obviously cannot fix other broken programs, although as  
explained it is sufficiently flexible to deal with them.


Jonas



More information about the fpc-pascal mailing list