it sounds like you are trying to read a UNIX text file on a windows machine (or vice versa). Different OS's have different ways of displaying line returns/newlines:
Windows:/r/n
UNIX: /n
Mac: /r
I usually strip out all of the /r's and just deal with the /n's.
BTW: if you have PHP 4.3.0, you could replace your fopen code with this:
$filecontent = file_get_contents ($attachurl);