I'm not sure if this is going to help you but I ran in to it when I was doing some page scraping. Some pages used \r\n, some used \n and I believe that some even used \r - although it's been a while and I could be wrong about the last one.
Is it possible that you're checking for a Windows return structure when it's a Unix one?
Hope that helps!
There is no emoticon for what I'm feeling now.