• I’m sure this has been reported here a number of times, but if you edit the css file of a theme on a Mac, it screws the thing up because the default line ending of Macintosh(\r) is different from Unix’s(\n) and Windows'(\r\n).

    It is caused by the file() function used inside the get_theme_data() function (/wp-includes/function.php). The file() function by default does not recognize the mac line endings.

    So I suggest you define the function below somewhere and use it instead of the default file():

    function file_wp($filename) {

    $f = fopen($filename, “rb”);
    $buffer = fread($f, filesize($filename));
    fclose($f);
    $lines_array = preg_split(“/\r?\n|\r/”, $buffer);
    return $lines_array;

    }

    Hope the problem will be gone this way, or any other way for that matter, with a future update.

Viewing 4 replies - 1 through 4 (of 4 total)
  • An even simpler (=without messing with code) solution is to have a text editor where you can define the line endings. That’s what has been suggested in numerous cases.

    Thread Starter delarge

    (@delarge)

    Yes, I also think that’s the simplest way for normal users right now, but I just hope the developers will address the problem with a future update because that’s still too much hassle for Mac users. I believe wordpress should support as large a number of people as possible by default without forcing some people to do something extra, and the solution is pretty simple on this issue at least on the developers’ side.

    There are freeware text editors for the Mac that lets you choose line breaks, my favorite is TextWrangler.

    I was just having this problem. If you are using BBedit or Texwrangler you can change the line endings to Unix Style in the menu bar of the document (the drop down menu that looks like a doc will have “mac” and “unix”–switch to Unix)

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘To avoid the problem caused by a css file edited on a Mac’ is closed to new replies.