I had this issue just two days back in PSPad 5.0.4(527) with a PHP file of ~780 lines, "Unicode UTF-8 no BOM (65001)" code page, and HTML multihighlighter. The garbage occurred somewhere in the middle of the file, an 'echo' command got replaced, maybe some characters more. But I was working at the top of the file, and saving it all few seconds via CTRL+S. Because I know about this bug since a while, I did not think much about it, just replaced the broken section from a backup. So I don't know which steps I did exactly before the issue came up. Luckily it happens less often than in the past.
Friendly greetings, Ravelli -- <https://forum.pspad.com/read.php?4,73692,74302> PSPad freeware editor https://www.pspad.com