Windows Notepad Now Supports Unix Line Endings

In what is probably this century’s greatest advancement in technology, Windows Notepad now supports Unix line endings. This is it, people. Where were you when Kennedy was assassinated? Where were you when Neil Armstrong set foot on the moon? Where were you when Challenger blew up? Where are you now?

Previously, Windows Notepad only supported Windows End of Line Characters — a Carriage Return (CR) and Line Feed (LF). Unix text documents use LF for line endings, and Macs use CR for line endings. The end result of this toppling of the Tower of Babel for End of Line characters is a horrific mess; Windows users can’t read Unix text files in Notepad, and everything is just terrible. Opening a Unix text file in Windows produces a solid block of text without any whitespace. Opening a Windows text file in anything else puts little rectangles at the end of each line.

Starting with the current Window 10 Insider build, Notepad now supports Unix line endings, Macintosh line endings, and Windows line endings. Rejoice, the greatest problem in technology has now been solved.

138 thoughts on “Windows Notepad Now Supports Unix Line Endings

    1. UNIX line endings are not LF. That’s just a default. UNIX line ending is “”nl” or newline (‘\n’ in printf): it’s whatever character was defined as “newline” by the stty command. ASCII contains no ‘newline’ character. LF was just convenient and intuitive for a default.

      This dates back to text terminals and special character meanings, all of which can be mapped to other values. Thus demonstrating even more deeply how flawed Windows (but not its predecessor VMS!) have always been. At least VMS knew about special character mapping.

      1. I found it interesting to see an article about windows notepad now supporting *nix line endings and then using the windows terminology [CR] [LF] instead of the *nix terminology \r \n

        The association is like this –
        [CR] Carriage Return => \r return
        [LF] Line feed => \n new line

        in web development this was solved long ago, to convert anything to *nix –
        str_replace(“\r\n”, “\r”, $string); str_replace(“\r”, “\n”, $string);
        which can be simplified to –
        str_replace(“\r”, “\n”, str_replace(“\r\n”, “\r”, $string));
        from there you can convert to the other standards easily if needed and without any double line spacing.

        I use metapad instead of notepad. Another favorite is Crimson Editor (has a new name now) because you often need to first find the text to be edited and Crimson Editor has search within text, search within file and search withing directory.

        1. Line feed was in the ASCII standard from the beginning. “New line” could not be added because ASCII was a 7 bit code, and all 128 codes were assigned by the time the concept of newline was brought up. Unicode gets crap added to it all the time because that’s a 32 bit code, so there are over two billion “code points” available. Going fast, I’m guessing.

      1. In what way is that pseduoscience? And why shouldn’t such things be studied given that they may improve the lives of people?

        It may be a flawed experiment but that doesn’t make it fake science – just (potentially) incomplete.

      1. Exactly! Tabs should represent levels of indentation. 1-tab per level of indent. That’s perfect! How much whitespace I want to see per level of indentation is my business and how much you want to see is yours. We can configure that in our editors’ preferences and each see the same source code in the way we want to see it.

        I grew up when monitors and resolution were much smaller. Huge indents meant line wrapping and nobody wanted that. We didn’t have wide screens for coding, those were for watching movies! In college my Computer Science professors varied, some wanted 2 spaces per indent, some wanted 3. That’s it, no more than 3! I preferred 3 because that is also how far I was taught to indent the beginning of a new paragraph in English class. I like consistency.

        Kids these days like huge indents with large numbers of spaces. That’s fine for you if you like it. I find that incredibly distracting when I try to read the code. All that left/right movement makes me tend to lose my place. I know some people have told me that they find my narrower indents harder to see. Well.. different people see things differently! That’s why we need to use tabs!

        But… all the style guides these days push spaces instead of tabs for indents. WTF?!?! With tabs we can ALL have our way! Just configure your editor to display tabs the way YOU like them and leave ME alone about it. That is a way better solution than trying to figuratively club everyone over the head until they agree to use YOUR favorite number of space characters.

        Come on, quite being A@@H0l3s!

        Ok… Sorry… End Rant

        1. I used to think as you do, and for the same reasons. I’ve recently decided to throw in the towel and use spaces for indentation. If your editor can display tabs as your preferred amount of horizontal space, it should be able to scan the code, figure out the number of spaces used per level of indentation, and display it the same as if tabs had been used (as $DEITY intended). I suppose some unholy mixed-tabs-and-spaces files will defeat the indentation heuristic.

          I’ve resolved to write plugins or modify editor code to accomplish this, if necessary, but so far I am able to just deal with it.

          Don’t even get me started on where some of these heathens put their braces.

          1. That might be a solution but it’s a difficult and brittle solution to a problem that was already solved by all our keyboards having a TAB key.

            It requires you or someone to write plugins.

            It only works for text editors for which such plugins have been written.

            It will fail if people type the wrong number of spaces.

            This solution describes displaying code. How does one write it? Do you still press the space bar x number of times at the beginning of each line? What does the plugin do while the user is entering those spaces?

            How does it react to space characters elsewhere in the code. Maybe there are space characters inside string literals for example. How do those display? What is it like to edit them?

          1. That is a really common and yet stupid excuse to use spaces instead of tabs.

            Obviously you do the same thing that you do with code that has the incorrect number of spaces. Honestly it’s just another variation of the same problem!

            What do you do when your standard is to use 25 spaces per indent (cause that seems to be the direction things are headed) and some dummy submits a million lines of code with only 15? If it’s a workplace the manager reminds them of the company policy and they have to fix it. If it’s an open source project then it depends on how desperate the maintainer is to attract coders. They either painstakingly fix it all or they deny the pull request with a message to go read the f’n style guide.

            Switching away from using tabs does nothing to fix the problem of people not doing what they are supposed to.

            Maybe I am being a little unfair. If your tab character width matches that of the dummy that mixed in spaces then the problem might go unnoticed. Well.. if someone else has a different tab width it can be dealt with once they notice it. If not… well.. do you enjoy worrying about problems when nobody even notices them? If a tree falls in the woods… or if a problem goes unnoticed is it really even a problem?

            How about a text editor plugin that sightly shades tabs? Or.. better yet, maybe it brightly flags space characters that occur somewhere within a region of whitespace that is on the begining edge of a line? Then you know when somebody is a jerk right away and can deal with it.

            Or… if you discover that mixed indentation has been piling up for the last 10 years unnoticed because everyone used the same tab width just run it through a code beautifier.

            Or… can a script be added to git that either fixes, flags or bounces crappy pull requests that include space indented lines?

        2. Ramen. And yeah, if only the placement of those curly braces had some consistency as well. I prefer them in the older style of putting the brace on the next line. I don’t really understand the argument of having it on the same line as the class/method/branch definition. Particularly because there is no consistency on where to break that line. Is everyone else still stuck on 80 columns?

        3. I’ve always considered this a mute dispute. What improves readability for some people can have the opposite effect for others.

          I’m dyslexic so I use “whitesmiths” format so that I can quickly scroll through indentation levels to find the return from one level.
          https://en.wikipedia.org/wiki/Indentation_style

          If someone doesn’t like it then I just say – well can you code, if you can then just change it to what you like, it’s just a string of text

        1. It opens undotree for me :o but ctrl shift c kills any active program, it seems I need to type more so it’s counter productive… Does anyone know when Linux notepad port will come?

          1. Leafpad is my go-to for quick text edits, it’s basically a Notepad knockoff.

            I still miss the old System 7 compatible versions of BBEdit.

    1. There are various better replacements. But the advantage of notepad is that is installed by default, and used by “random” people to open txt files. This change makes it just a bit easier to uncivilized people to open random text files like config files and log files.

        1. The Muggles. The Great Masses. Those who have not been educated in our ways and traditions. Those who tremble at the very mention of command line, of monospace text, and of white text on black background.

    1. Hmmmm. Never seen an x86 machine with a panel of switches and lights. WHY NOT??!!!

      Oh. Nevermind. Just realized: any real hacker wouldn’t be using an x86 machine. They would be using an ARM processor implemented with relays and 3D-printed neurons.

  1. Errrmmm, isn’t this why filter programs were given to us by the Forrest fairies, or the find and replace function was prophesied by hunter-gatherers and passed down through the generations until computers were invented thus completing the circle of knowledge whince every idea finds its use.
    To correct the problem before the solution can be applied is almost a blasphemy in that it prevents the circle of knowledge from forming After that it’s all fun and games until someone builds a fire and starts yelling “burn the witch.”
    Do we need to burn someone at the stake to keep our hallowed traditions alive!!

  2. I suppose someone should point out that Macs haven’t used CR for years (aside from old Carbon programs that aren’t used much anymore) … modern macOS apps all typically use LF by default because that’s what Cocoa uses. (But typically Mac apps can read files using any of LF, CR, or CRLF. Some programs will preserve a file’s original line endings but others will convert them to LF when saving.)

    1. Yup. When faced with a wall-of-txt file, open and save in Wordpad, then it’ll open properly in Notepad.

      What’s next? Microsoft fixes the square root error in Calc? OMFG! They did! Enter 4, click the square root button, then X then =. The answer displayed *is now the correct 4*, apparently done in some recent update to Windows 10.

      In prior versions of Windows, the answer reached *was not 4* despite the square root of 4 being displayed as 2. That 2 was a *lie*. Internally it was calculating *almost 2*.

      Well, since MS has finally gotten around to fixing these two very important issues, that must mean there’s nothing left to fix in Windows.

      1. Yeah, but calc in win10 does not respect regional settings anymore… Decimal character always a dot. 1000 delimiter always a comma. Unbelivable… (I can’t choose my preferred os at work, and win10 is the worst thing since winME in my opinion…)

          1. Yes!!!!!!!!!!!!!!
            At least in Windows 8 Professional you can set Group Policies and they’ll stick through Windows Updates…

            Windows 10 Professional is like Windows Home edition of the Windows 8, 7, vista and XP eras.
            Windows 10 Home is like Windows 8-BING.
            .
            .

            The only reason I’ve not installed Linux to my Dell Venue 11 pro is because of issues like over-heating (then leads to irresponsive touchscreen and lock-ups) and due to turbo modes not seemingly supported (p.s. no over-heating when configuring without pulse-audio… then Firefox AKA FAILFOX won’t work!!!).
            Until I can work out stability issues, then my E6400 is my daily driver and the Win 8 Venue 11 Pro is my long-distance maps (built in 3G modem, maybe a 4G)

        1. Get used to it buddy. Windows 11 will be switching you back to Imperial measures and there is nothing you can do about it! Your governments and schools will keep using Windows because just like hipsters can’t not use iPhones they can’t not use Microsoft products. So.. your culture will be converted one piece at a time. And.. there is nothing you can do about it because the unstoppable process has already begun! I guess you didn’t notice when the little crosses all disappeared from the 7s in all your Windows fonts did you? That was your last warning sign before the point of no return. You might as well go hang up your American flag now because resitance IS futile!

        2. The behavior I’m seeing is the absolute opposite: before Windows 10 the calculator didn’t care about region settings but now it does.

          Actually that’s irritating as before I could use decimal points but now “have to” use decimal comma.

    2. “since like what, Windows ME?”

      Oh thanks! Great way to ruin my morning, bringing up those dreadful memories…
      Now I suppose you’ll replay for us the ending of “Jurassic Bark”!
      B^)

  3. I am going to stay inside all week. I expect rioting in the streets. Probably widespread rioting and looting. I’m locking the doors right now and filling sandbags. Not that I don’t welcome the great news, but some people won’t be able to control themselves.

    1. Agreed. Notepad is hardly the first program to work correctly with multiple line endings. I’ve never seen any line ending issues in any Linux editor, nor Visual Studio, nor Adobe Dreamweaver. The only issues I have ever seen are some Windows programs, especially (possibly only) with Notepad.

      1. Thing is that sometimes you open a file, looks OK, you make a small change, save it, and then the file is messing up the program that uses it. For instance if it’s a config file.
        It’s not about simply about displaying it but about the other software that uses it no getting confused when it’s saved back.

  4. Must be April 1st… /me shakes wristwatch and double checks it is working…
    Nope… not April 1st.. probably a bug then, it will be removed in the next version.

  5. But what will happen if i open a Unix txt file in the new editor and then add a new line ? Will it add a Windows linebreak and make the whole document some sort of weird mix ? or will it convert everything. I also agree with the choice of notepad++ as best editor, not perfect, but far superior.
    If notepad could now also improve the way it handels files, that would be great. Ever tried to open a file with 1MB or more ? Takes ages. Notepad++ opens the files much faster.

    1. “New files created within Notepad will use Windows line ending (CRLF) by default, but it will now be possible to view, edit, and print existing files, correctly maintaining the file’s current line ending format.”

      Look like it will maintain the EOL style of existing files but will use the Windows EOL for new files.

    1. I was a DOS era Qedit fan as well. Blazingly fast in an era of slow processors and bloated operating systems. But when Notepad++ came out I started reforming my proprietary code ways. Notepad++ with plugins and MULTIPLE language support (and customizable for those it doesn’t support) has become my go to editor.

  6. I think you’re being overly hard on microsoft – don’t you realise that hardware has only just got powerful to do the extremely sophisticated processing required to find and isolate these non readable characters that are by themselves – and do something about them? Have you considered the millions of man hours it would have taken? (or the thousands of women hours?).
    We should stand in awe of their accomplishment, and thank intel for moving to a default of 6 cores so that these types of extreme problems can finally be addressed…

  7. Most printers (and certainly the old ones; Teletypes, Impact Dot-Matrix, Daisy-Wheel) use the LF character for a line feed. The paper advances and the carriage remains in the same position. Likewise, a CR causes the carriage (print head) to return to the home position on the left but does not advance the paper, causing you to overtype the line. Therefore, BOTH are necessary. That was also the case with most dumb terminals. Some of the smarter ones had a setting (off by default!!) that cause the printer or terminal to do a LF whenever it recieved a CR and/or do a CR when it received a LF. I believe this is still true even on modern receipt printers.
    So as much as I despise Microsoft and Notepad, they had it correct.

    1. That’s also technically why there are two Enter buttons on a keyboard. One of them was enter (line feed) and the other is return (carriage return).

      The reason why some terminals used carriage return to feed a new line was because you could hit carriage return to input multiple lines into the buffer, and then hit enter to send it. Otherwise you’d be locked out of typing until the buffer was transmitted, creating annoying pauses between lines.

    2. Maybe the CR people and the LF people assume the existence a printer drivers. It’s been quite a while since applications and operating systems tried to print by dumping the raw file to a printer port.

  8. Well, I think they were right.
    Carriage Return to go to the first character and then Line Feed to go to the next line.
    That’s two separate functions, and I never understand why *NIX just assume that a LF implies a CR.
    I mean, they are the ones keeping TTY and always beeing nitpicking, and for this particular point…

    1. “I never understand why *NIX just assume that a LF implies a CR”
      It saves an entire byte for each line in each text file.
      In 1970, when Unix was created (on a machine that maxed out at 256KiB), that actually mattered.

      1. More importantly, most non-printing terminals had no way of displaying overlapping characters. In some command line monitors (including Unix, for things like man), “bold” print could be implemented by doing a carriage return without line feed and retyping the characters needing emboldening. Later this was updated using backspaces and retyping to preserve the “bold” print feature of printing terminals without messing up the display on CRT terminals.

        This was one thing of several factors that led to the demise of APL, a language that was designed around IBM System 360 systems with Selectric based terminals. Many of the commands, termed “dyadic” commands, involved, I kid you not, typing a character, backspacing, and typing a different character. For example, you would type a “box” character, then backspace, then a single quote (apostrophe) over it for a command whose function escapes me at the moment. Tektronix made a terminal (4013?) specifically for APL – it used a storage CRT that actually COULD display overlapping characters. We had a whole room full of them at U.C. Irvine in 1973 or so. These were horrible for this application: they were very dim due to the limitations of direct-view storage tubes, AND they were extremely sensitive to burn-in, which meant that the area where the login prompt was displayed was made unreadable within a month of being put in service.

        Good riddance to CR-LF.

        1. LOL @ “Good riddance to CR-LF”

          Just about everything that goes across a TCP/IP connection uses \r\n [CRLF] as a line ending and \r\n\r\n to separate the header from the content.

          1. RÖB: I’m taking that with a grain of salt. I believe most protocols being transmitted over TCP/IP either ignore CR and LF entirely, treat them like any other character, or treat either one (or both, in either order) as a line ending. In particular, I’m pretty sure that HTML does not in any way expect to see \r\n\r\n between header and content. It may depend more on what OS the person writing the code uses than anything else.

        2. HTML is a code language that transfers across the protocol HTTP and HTTPS.

          HTML has the Document Object Module (DOM) elements <HEAD> and <BODY> and these are not related to the HEADER and CONTENT that I mentioned. In fact the Whole HTML page comes from the content mentioned.

          What you see in the browser is just the content after the header is stripped off.

          Here is an example of the full server response that shows bit the header and content (part of) and the use of line endings.


          HTTP/1.x 200 OK\r\n
          Transfer-Encoding: chunked\r\n
          Date: Sat, 28 Nov 2009 04:36:25 GMT\r\n
          Server: LiteSpeed\r\n
          Connection: close\r\n
          X-Powered-By: W3 Total Cache/0.8\r\n
          Pragma: public\r\n
          Expires: Sat, 28 Nov 2009 05:36:25 GMT\r\n
          Etag: "pub1259380237;gz"\r\n
          Cache-Control: max-age=3600, public\r\n
          Content-Type: text/html; charset=UTF-8\r\n
          Last-Modified: Sat, 28 Nov 2009 03:50:37 GMT\r\n
          X-Pingback: http://net.tutsplus.com/xmlrpc.php\r\n
          Content-Encoding: gzip\r\n
          Vary: Accept-Encoding, Cookie, User-Agent\r\n
          \r\n
          <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\n
          <html xmlns="http://www.w3.org/1999/xhtml">\n
          <head>\n
          <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />\n
          <title>Top 20+ MySQL Best Practices - Nettuts+</title>\n
          <!-- ... rest of the html ... -->

    2. And why would you want to go to the next line without going back to the start of it? Going to the start without going to the next line (CR) makes some sense in limited circumstances. Going to the next line but keeping the character position (LF), to me, only makes sense if you’re trying to match your character set to a mechanical printer.

      1. In the very old days of 110 and 300 bit/sec communications over modems, every character counted, and most terminals had quick ways of getting from one place on a screen or page to another, including cursor movement codes in all directions. This allowed applications that used forms to skip from one entry field to another without having to redraw the whole screen. LF was usually used as the “down one line” code.

        The same would go for applications that printed onto pre-printed forms, which used to be popular. Again, this got to a specific place on the page without having to send a whole series of spaces.

        No, it doesn’t make sense today. This is just legacy.

    1. Ren: this is true, but this changed with Teletypes. With typewriters, carriage return is a blocking operation, when used by a properly trained typist: you do not start typing characters again until the carriage return is complete, even though you have your right hand available. With Teletype machines connected to computers, the practice was to do carriage return first, then line feed. This was because the carriage return could complete while the line feed was being done, and for 10 character/sec 72-column machines, this was enough of a delay, that no extra handshaking or dummy characters needed to be inserted.

      1. To clarify a bit further: if you sent LF-CR, then the next line without any delay, then the first character of the next line would be printed wherever the print head happened to be when that character was received, which could be 1/3 of the way across the page.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s