Welcome Guest, Not a member yet? Register   Sign In
why CI have to Standardizes newline? it changes 1 newline to double newline (CI2.0)
#6

[eluser]squirrels[/eluser]
That doesn't work. I think we have a problem with double replacement in the str_replace function. So we replace all "\r\n", "\n", and "\r" with a dummy character that shouldn't be finding itself in the data, then change him to PHP_EOL. I picked the delete character ASCII code 127. I also threw in the "\n" character for the Mac operating system.

// Standardize newlines if needed
if ($this->_standardize_newlines == TRUE)
{
if (strpos($str, "\r") !== FALSE)
{
$str = str_replace(array("\r\n", "\n", "\r"), chr(127), $str);
$str = str_replace(chr(127), PHP_EOL, $str);
}
}


Messages In This Thread
why CI have to Standardizes newline? it changes 1 newline to double newline (CI2.0) - by El Forum - 02-22-2011, 07:18 PM



Theme © iAndrew 2016 - Forum software by © MyBB