You should be able to replace it with a preg that removes all newlines and carriage returns. The code is:
preg_replace( "/\r|\n/", "", $yourString );
Even though the \n
characters are not appearing, if you are getting carriage returns there is an invisible character there. The preg replace should grab and fix those.