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);
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
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
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
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
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
--
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
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
8 matches
Mail list logo