Re: preg_replace ^M

From: Date: Thu, 06 Nov 2003 15:03:00 +0000
Subject: Re: preg_replace ^M
References: 1 2 3 4 5  Groups: php.general 
Request: Send a blank email to php-general+get-168731@lists.php.net to get a copy of this message
Torsten, et al -- ..and then Torsten Rosenberger said... % % > So that program is writing \r\n as the newline instead of just \n. It's % > still just your editor that's displaying the ^M. Maybe you should get a new % > editor. % i use vim Good :-) % % and the input file don't have \r\n they look normal in vim % after the preg_replace in php then they have the ^M I suspect that you have a DOS format file which, after replacement, has a line with only \n (no \r) which makes it a UNIX format file -- with lots of extra \r chars in there. Open your source file with vim. Type :set fileformat and hit return and see what it says (my bet is 'dos'). Type :set fileformat=unix :wq! and then run your script again and check the output (my bet is no more ^M chars). % % BR/Torsten HTH & HAND :-D -- David T-G * There is too much animal courage in (play) davidtg@justpickone.org * society and not sufficient moral courage. (work) davidtgwork@justpickone.org -- Mary Baker Eddy, "Science and Health" http://justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg!

« previous php.general (#168731) next »