Darren Kitchen Posted November 20, 2011 Share Posted November 20, 2011 The Config menu on the Mark III makes it easy to update a variety of config files. Unfortunately the way PHP is writing to those files it is adding additional linebreaks which are showing up as ^M when seen in vi (but not the config page or cat). Here's a little more on the problem: http://hints.macworld.com/article.php?story=20001206164827794 Adding $newdata = preg_replace('/\r/', "\n", $newdata); after the { on line 18 of config.php would solve the issue, except that the version of PHP on the Mark III doesn't support PCRE or Perl Compatible Regular Expressions. So while I'm researching a way to solve this for the upcoming 1.0.2 update, I'm wondering if any PHP gurus out there know of the tops of their heads how to do the same without using the preg_replace() function. Perhaps ereg_replace()? Thanks, appreciate any input. Cheers. Quote Link to comment Share on other sites More sharing options...
brianzimm Posted November 20, 2011 Share Posted November 20, 2011 (edited) Not sure if this helps but found this on php.net http://www.php.net/manual/en/function.strtr.php#60195 // if you are upset with windows' ^M characters at the end of the line, // these two lines are for you: $trans = array("\x0D" => ""); $text = strtr($orig_text,$trans); // note that ctrl+M (in vim known as ^M) is hexadecimally 0x0D OR https://bugs.php.net/bug.php?id=3169&edit=3 $string = ereg_replace(13, "", $string); /* get rid of Ctrl-M */ Edited November 20, 2011 by brianzimm Quote Link to comment Share on other sites More sharing options...
Darren Kitchen Posted November 21, 2011 Author Share Posted November 21, 2011 Thanks! That did the trick :) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.