Revert 81a432 and re-fix the script

The fix in 81a432 introduced invisible characters (BOM, Windows CR/LF). Reverted and re-fixed.