Maybe I know what it is... Let me guess - your files are encoded in UTF-8? If yes then be aware that some text editors adds utf8 header to file - it is possible that garbage which you see in output is this header. Of course you will not see it in your text editor, because it is ok according to utf-8 format.
Just save each your file in other text editor which for sure is not adding header when saving in utf8 (i.e. in notepad2 you can choose utf8 and utf8 with signature – use it without signature).
Let me know does it help