Closed einstein95 closed 1 year ago
Thanks for reporting! I had a look and there seem to be a number of things wrong with the code that decides whether to open a text or binary stream. The intended behaviour is that --text-encoding
only affects text files (plaintext programs and data files opened for INPUT
, OUTPUT
or APPEND
). Here the binary program is opened as a text file, then treated as binary again, leading to the exception reported.
Aside - come to think about it, is it right for --text-encoding
to be applied to data files at all? They might be used for binary data with the likes of MKS$
. On the other hand, any code page covers all byte values by definition, the output would be mangled but consistent if read with the same codepage setting.
Resolved by commit 676a231
Bug report
Problem
When using
--convert=B
and--text-encoding
in the same command line, pcbasic fails to do so. I expected pcbasic to decode the plain text file using the specified text encoding and then save it as binary.Steps
pcbasic --text-encoding=437 --convert=B plaintext.bas --output tokenized.bas
Program Any plain text program should do the trick.
Crash log
Notes
PC-BASIC version: PC-BASIC 2.0.6 Operating system version: Arch Linux