WinSCP defaults to the binary mode.
It's possible that you have re-configured the GUI to use the ascii mode and your script is not isolated form the GUI configuration, so the change to the defauts affected your script too.
See https://winscp.net/eng/docs/scripting#configuration
It's possible that you have re-configured the GUI to use the ascii mode and your script is not isolated form the GUI configuration, so the change to the defauts affected your script too.
See https://winscp.net/eng/docs/scripting#configuration