getButterfly Logo getButterfly code wrangling since 2005

I’ve recently had an issue with Notepad++, which rendered many of my PHP and CSS documents useless by getting all code on one line.

It was then when I noticed the document type was Macintosh, while my desktop environment is Windows-based and the server is Linux-based.

Notepad++ Issue

After a few searches, this behaviour resulted being a bug, a combination of FileZilla and Notepad++ filetype reading.

Notepad++ IssueThe solution is as easy as selecting Edit -> EOL Conversion -> Windows Format, and the entire file should be converted to CRLF (Dos\Windows). Notepad++ uses the format that is used in the file that is opened.

Another verification option might be to show the line ending characters (View -> Show Symbol -> Show End of Line) so you know what you’re dealing with when you open a file.

Here’s a common issue, as quoted from Wikipedia: “The different newline conventions often cause text files that have been transferred between systems of different types to be displayed incorrectly. For example, files originating on Unix or Apple Macintosh systems may appear as a single long line on some Windows programs. Conversely, when viewing a file originating from a Windows computer on a Unix system, the extra CR may be displayed as ^M or <cr> at the end of each line or as a second line break.”

As I’m sure no one is using Macintosh for programming, this should be a rare issue.

Note: You can also use UNIX on Windows-based development environments.

Subscribe to getButterfly Blog

Once a week or so we send an email with our best content. We never bug you, we just send you our latest piece of content.

If you found any value in this post, agree, disagree, or have anything to add - please do. I use comments as my #1 signal for what to write about. Read our comment policy before commenting! Comments such as "Thank you!", "Awesome!", "You're the man!" are either marked as spam or stripped from URL.

Leave a reply

Love programming?

Learn about the most amazing things. Get smarter everyday!