why CI have to Standardizes newline? it changes 1 newline to double newline (CI2.0) - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: why CI have to Standardizes newline? it changes 1 newline to double newline (CI2.0) (/showthread.php?tid=38536) |
why CI have to Standardizes newline? it changes 1 newline to double newline (CI2.0) - El Forum - 02-10-2011 [eluser]vee[/eluser] in textarea form if user enter one newline CI change it to double newline like this Quote:line 1 to Code: line 1 is it a bug? how to fix it? >:-( why CI have to Standardizes newline? it changes 1 newline to double newline (CI2.0) - El Forum - 02-15-2011 [eluser]kipras[/eluser] I have the same problem why CI have to Standardizes newline? it changes 1 newline to double newline (CI2.0) - El Forum - 02-21-2011 [eluser]Future Webs[/eluser] related post here http://ellislab.com/forums/viewthread/180436/ https://bitbucket.org/ellislab/codeigniter/issue/332/newlines-in-textareas-are-duplicated why CI have to Standardizes newline? it changes 1 newline to double newline (CI2.0) - El Forum - 02-21-2011 [eluser]vee[/eluser] this is my fix http://www.okvee.net/2011/02/16/xss-filter-in-ci-2-get-2-new-line/ this double new line is very ugly bug and occurs when using $_POST or $_GET create MY_Input.php in application/core Code: class MY_Input extends CI_Input { why CI have to Standardizes newline? it changes 1 newline to double newline (CI2.0) - El Forum - 02-21-2011 [eluser]Future Webs[/eluser] thanks man, that seemed to have sorted it for now while we wait for it to get resolved in the official version why CI have to Standardizes newline? it changes 1 newline to double newline (CI2.0) - El Forum - 02-22-2011 [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); } } why CI have to Standardizes newline? it changes 1 newline to double newline (CI2.0) - El Forum - 02-27-2011 [eluser]furball[/eluser] will this work? Code: // Standardize newlines if needed why CI have to Standardizes newline? it changes 1 newline to double newline (CI2.0) - El Forum - 03-02-2011 [eluser]squirrels[/eluser] Furball has the winning solution. I think we should standard new lines if the string contains a "\r" or a "\n". The conditional statement needs to be changed. I just removed it. |