[fpc-pascal] Executing external processes and codepages
Michael Van Canneyt
michael at freepascal.org
Wed May 11 11:51:57 CEST 2016
On Wed, 11 May 2016, Marco van de Voort wrote:
> In our previous episode, Michael Van Canneyt said:
>>> I'm not sure what you are suggesting as alternative. Saving the encoding at
>>> startup, so it can be reused in cases like this, in case somebody change
>>> defaultsystemcodepage?
>>>
>>> Or using defaultsystemcodepage instead of filesystem encoding?
>>
>> Why not simply make the exec calls use RawByteString ?
>>
>> It is then the responsability of the programmer.
>> 99,99% of cases it will get passed the correct system encoding, and if need
>> be the programmer can change it.
>
> I don't like that. The 3.x idea is to get rid of manual conversions and
> hack-and-convert-it-as-you-go encoding management, not just rebadge the old
> practices to rawbytestring.
You may not like it, but there is simply no other choice:
Since you don't know what the receiving program does with the receives
arguments, all attempts to guess it are erroneous by definition.
Only the programmer knows what the receiving program will do (or should),
so he must take it into account. Hence rawbytestring.
Don't pamper the programmer so much. He needs to make correct decisions.
Michael.
More information about the fpc-pascal
mailing list