static function fixNewlines($text) { // replace \r\n to \n $text = str_replace("\r\n", "\n", $text); // remove \rs $text = str_replace("\r", "\n", $text); return $text; }