Are you sure you replaced all of the invalid (tabs, windows line endings) characters? How did you do that?
Sometimes the IDE can change the line endings when you save the files. Maybe it is only at the end of the file.
If you can at least try on a Linux machine, I would definitely do that. If you can, use the same IDE with same settings if it is multiplatform. You should be able to build on Windows if the sourcecode is correct. I know you tried to fix it, but you may missed something.
If your git client changes the line endings for example, you can try to download the sourcecode without git from a webbrowser as a ZIP archive. (Click on Code, then “Download ZIP”)
The other solution could be to use multi-stage build where you use a different build stage to download the sourcecode and copy the code into an other stage. This is the reommended way if you don’t want to change the code. Of course you would need to make sure you always use the same version but that is perhaps another question for later.
While you are trying these solutions I wil try on it on Windows.
Update:
I tried it and it works if the core.autocrlf is false in the git config.This is how I installed Git For Windows:

You can change it after the installation in the git config