This has happened to me at least 8 times on Windows 10 with versions of PSPad like 5.0.x. I don't know a fix for it. It happens in my Perl programs and when I run the program I get an error. I find and remove the wrong characters.
I looked for a fix but have not found any. The author says PSPad 5.0.7 32 bit is more stable so you can try that one. -- <https://forum.pspad.com/read.php?2,77347,77392> PSPad freeware editor https://www.pspad.com