[PHP] preg_replace ^M

2003-11-06 Thread Torsten Rosenberger
Hello i try to replace a string in a file but if i have linefeeds in the string the output file after the replacement has ^M carachters in in if the $replacements[] = test; has no \n in it all is OK $fp = fopen (draft.html, r); $incont = fread ($fp,filesize(draft.html)); fclose ($fp);

Re: [PHP] preg_replace ^M

2003-11-06 Thread Marek Kilimajer
Those are \r characters from dos newline (\r\n). Generally they are not harmful and many editors can work with them without problems (vim). You can use some utility commands to convert to or from dos or unix newlines. Torsten Rosenberger wrote: Hello i try to replace a string in a file but if

Re: [PHP] preg_replace ^M

2003-11-06 Thread Torsten Rosenberger
Hello Those are \r characters from dos newline (\r\n). Generally they are not harmful and many editors can work with them without problems (vim). You can use some utility commands to convert to or from dos or unix newlines. But i'm working under Linux. I made a test with HTML Template IT

Re: [PHP] preg_replace ^M

2003-11-06 Thread CPT John W. Holmes
From: Torsten Rosenberger [EMAIL PROTECTED] i try to replace a string in a file but if i have linefeeds in the string the output file after the replacement has ^M carachters in in Some text editors will display \r as ^M. So, if you're file uses \r\n as the newline, you'll see these ^M at the

Re: [PHP] preg_replace ^M

2003-11-06 Thread CPT John W. Holmes
From: Torsten Rosenberger [EMAIL PROTECTED] Those are \r characters from dos newline (\r\n). Generally they are not harmful and many editors can work with them without problems (vim). You can use some utility commands to convert to or from dos or unix newlines. But i'm working under

Re: [PHP] preg_replace ^M

2003-11-06 Thread Torsten Rosenberger
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 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 BR/Torsten --

Re: [PHP] preg_replace ^M

2003-11-06 Thread David T-G
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

Re: [PHP] preg_replace ^M

2003-11-06 Thread Christophe Chisogne
Torsten Rosenberger wrote: ^M carachters in in Classical pblm of representing end of line in text files between OS: windows uses \r\n aka CRNL *nixuses \n aka NL (newline) mac uses \r aka CR (carriage return) Good text editors dont care (win: wordpad, not notepad) and can convert while