Page 2 of 2

Posted: Fri Feb 09, 2007 10:48 am
by volka
abeall wrote:So if PHP is getting \n, why is it converting them to 
, if it doesn't help anyway?
A friend of mine usually answers these kind of questions with "because it can" ;)
All I can tell you is php calls the function xmlNewDocNode of libxml2 to create a new text node. Maybe you can contact someone more involved with http://xmlsoft.org/index.html to answer your question.

Posted: Fri Feb 09, 2007 10:54 am
by abeall
Fair enough. And great idea, I'll head over to xmlsoft and see if they can help me solve my problem. I'll report back if I find anything.

Thanks, all!

Posted: Sat Feb 10, 2007 9:32 pm
by abeall
Solution:

Code: Select all

foreach ($_POST as $key => $val)
	$_POST[$key] = str_replace("\r",'',$_POST[$key]);
Apparently, the parser converts \r to $#xD; but leaves \n alone. Since I was posting from a Windows machine, the data has \r\n at the end of each line, and the parser encoded \r but left \n alone. So stripping out the useless \r fixed things.