Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. And we're back to the eighties again...

And we're back to the eighties again...

Scheduled Pinned Locked Moved The Lounge
comquestion
22 Posts 12 Posters 2 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Rage

    Ah, I see you wrote a small application - I used to do that also, when I was still in development. :-D Today, Text editor -> Ctrl+H -> replace "\r\n" with "\n" :sigh:

    Do not escape reality : improve reality !

    J Offline
    J Offline
    James Curran
    wrote on last edited by
    #8

    Actually, for most text editors, it should just be

    Load, Save

    Truth, James

    K 1 Reply Last reply
    0
    • J James Curran

      Actually, for most text editors, it should just be

      Load, Save

      Truth, James

      K Offline
      K Offline
      kalberts
      wrote on last edited by
      #9

      Many plaintext editors default to preserving the newline convention detected when reading the file. So, between the reading and writing, you may have to change the newlinesetting before saving the file. I did write a similar mini-program a few years ago, doing not only newline changes, but also tab expansion (where you could specify a sequence of tab stops), transformation from a specified DOS codepage to ISO 8859-1, etc. Today, I do not encounter such a variety of text files; besides, I believe that Notepad++ can do 95% of what my program did. Today, I use Notepad for such tasks.

      1 Reply Last reply
      0
      • OriginalGriffO OriginalGriff

        Did you know that if you export contacts in Outlook CSV format from Google Contacts, Outlook can't read it? :laugh: No, seriously. And why? Because it's stored with "\n" as the line separator instead of "\r\n" and Outlook doesn't like that, not at all. A windows app (Chrome) writes a text-based file that another Windows app (Outlook) can't read because the line terminator is Windows standard rather than it's preferred format. I thought we killed that in the eighties! Guess what, Microsoft? Excel can read it. Excel reads it fine provided it's got any type of line terminator ... :doh: [edit] OK, it's a trivial change:

                string inPath = @"C:\\Users\\PaulG\\Downloads\\ToConvert\\Contacts\\GoggleContacts.csv";
                string outPath = @"C:\\Users\\PaulG\\Downloads\\ToConvert\\Contacts\\GoggleContacts2.csv";
                string\[\] lines = File.ReadAllLines(inPath);
                string appended = String.Join("\\r\\n", lines);
                File.WriteAllText(outPath, appended);
        

        but it shouldn't be necessary, not at all ... not this century. [/edit]

        "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony AntiTwitter: @DalekDave is now a follower!

        J Offline
        J Offline
        jsc42
        wrote on last edited by
        #10

        Just use Excel. Load the file and re-save it. That should work unless Outlook is fussy about quoted strings - Excel always quotes strings in CSVs even if the original Griff string was unquoted and unchanged. Anyway, glad to hear that you are on the mend, albeit slowly. Take it carefully.

        1 Reply Last reply
        0
        • R Rage

          Ah, I see you wrote a small application - I used to do that also, when I was still in development. :-D Today, Text editor -> Ctrl+H -> replace "\r\n" with "\n" :sigh:

          Do not escape reality : improve reality !

          J Offline
          J Offline
          Jorgen Andersson
          wrote on last edited by
          #11

          Since were all programmers: Open the file in VS, File -> Advanced Save options...

          Wrong is evil and must be defeated. - Jeff Ello

          R 1 Reply Last reply
          0
          • OriginalGriffO OriginalGriff

            Did you know that if you export contacts in Outlook CSV format from Google Contacts, Outlook can't read it? :laugh: No, seriously. And why? Because it's stored with "\n" as the line separator instead of "\r\n" and Outlook doesn't like that, not at all. A windows app (Chrome) writes a text-based file that another Windows app (Outlook) can't read because the line terminator is Windows standard rather than it's preferred format. I thought we killed that in the eighties! Guess what, Microsoft? Excel can read it. Excel reads it fine provided it's got any type of line terminator ... :doh: [edit] OK, it's a trivial change:

                    string inPath = @"C:\\Users\\PaulG\\Downloads\\ToConvert\\Contacts\\GoggleContacts.csv";
                    string outPath = @"C:\\Users\\PaulG\\Downloads\\ToConvert\\Contacts\\GoggleContacts2.csv";
                    string\[\] lines = File.ReadAllLines(inPath);
                    string appended = String.Join("\\r\\n", lines);
                    File.WriteAllText(outPath, appended);
            

            but it shouldn't be necessary, not at all ... not this century. [/edit]

            "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony AntiTwitter: @DalekDave is now a follower!

            L Offline
            L Offline
            littleGreenDude
            wrote on last edited by
            #12

            I would gladly go back... The eighties were awesome, totally! Big hair, parachute pants, Walkman's... etc. Hacking out basic code on a Radio Shack Color Computer (CoCo), and Apple IIe Life was good... you could shake people's hands, hug a friend, go to the movies. :)

            Remember, no matter where you go... there you are.

            OriginalGriffO K 2 Replies Last reply
            0
            • L littleGreenDude

              I would gladly go back... The eighties were awesome, totally! Big hair, parachute pants, Walkman's... etc. Hacking out basic code on a Radio Shack Color Computer (CoCo), and Apple IIe Life was good... you could shake people's hands, hug a friend, go to the movies. :)

              Remember, no matter where you go... there you are.

              OriginalGriffO Offline
              OriginalGriffO Offline
              OriginalGriff
              wrote on last edited by
              #13

              littleGreenDude wrote:

              go to the movies.

              Hmmm ... National Lampoon's European Vacation Police Academy Look Who's Talking Red Sonja K-9 Superman IV Mommie Dearest Howard the :elephant:ing Duck. Weird Science E.T. Trading Places The Money Pit ... OK, you also had Gremlins, Ghostbusters, and the Terminator, but ... you need very rose tinted glasses to watch most of 'em now! :laugh:

              "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony AntiTwitter: @DalekDave is now a follower!

              "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
              "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

              1 Reply Last reply
              0
              • L littleGreenDude

                I would gladly go back... The eighties were awesome, totally! Big hair, parachute pants, Walkman's... etc. Hacking out basic code on a Radio Shack Color Computer (CoCo), and Apple IIe Life was good... you could shake people's hands, hug a friend, go to the movies. :)

                Remember, no matter where you go... there you are.

                K Offline
                K Offline
                kalberts
                wrote on last edited by
                #14

                I guess that you are talking about going back to your youth carrying with you the 30-40 years of experience you have gained since. If you could go back to your youthful body and old-style surroundings, it would be something very different: it wouldn't be experiencing the insecurities and doubts and conflicts and whathaveyou, but an old man's view upon the world. That is what I could see as something desirable. But I never wanted to go back to my old mind, erasing all the experience I have gained. I never wanted to be a small kid again. Not a grown kid. Not a youth, nor a young adult, nor a middle aged man. I am happy that I am through with all those conflicts and demands and problems. It is much more satisfying leaning aback and relaxing with what I have gained.

                1 Reply Last reply
                0
                • OriginalGriffO OriginalGriff

                  Did you know that if you export contacts in Outlook CSV format from Google Contacts, Outlook can't read it? :laugh: No, seriously. And why? Because it's stored with "\n" as the line separator instead of "\r\n" and Outlook doesn't like that, not at all. A windows app (Chrome) writes a text-based file that another Windows app (Outlook) can't read because the line terminator is Windows standard rather than it's preferred format. I thought we killed that in the eighties! Guess what, Microsoft? Excel can read it. Excel reads it fine provided it's got any type of line terminator ... :doh: [edit] OK, it's a trivial change:

                          string inPath = @"C:\\Users\\PaulG\\Downloads\\ToConvert\\Contacts\\GoggleContacts.csv";
                          string outPath = @"C:\\Users\\PaulG\\Downloads\\ToConvert\\Contacts\\GoggleContacts2.csv";
                          string\[\] lines = File.ReadAllLines(inPath);
                          string appended = String.Join("\\r\\n", lines);
                          File.WriteAllText(outPath, appended);
                  

                  but it shouldn't be necessary, not at all ... not this century. [/edit]

                  "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony AntiTwitter: @DalekDave is now a follower!

                  P Offline
                  P Offline
                  PIEBALDconsult
                  wrote on last edited by
                  #15

                  While I essentially agree, why blame Microsoft rather than Google? They're actually equally to blame, but Google erred first. Besides, saying that the line terminator is \r\n is still imprecise; a line begins with \n and ends with \r . Get everything from the \n to the \r and you know you have a full and complete line; if not, you may have an incomplete line. (Of course, you also have to honor quotes and escapes.) Well, that and that it should be \n\r , but that's a different issue. Would you also like to argue the issues involved in the lack of a proper CSV standard? Just five minutes? Or the full half hour? Oh, wait, I also need to mention the superiority of the OpenVMS' file system...

                  OriginalGriffO K 2 Replies Last reply
                  0
                  • P PIEBALDconsult

                    While I essentially agree, why blame Microsoft rather than Google? They're actually equally to blame, but Google erred first. Besides, saying that the line terminator is \r\n is still imprecise; a line begins with \n and ends with \r . Get everything from the \n to the \r and you know you have a full and complete line; if not, you may have an incomplete line. (Of course, you also have to honor quotes and escapes.) Well, that and that it should be \n\r , but that's a different issue. Would you also like to argue the issues involved in the lack of a proper CSV standard? Just five minutes? Or the full half hour? Oh, wait, I also need to mention the superiority of the OpenVMS' file system...

                    OriginalGriffO Offline
                    OriginalGriffO Offline
                    OriginalGriff
                    wrote on last edited by
                    #16

                    Yes, I agree that Google are wrong as well, they should be letting the system take care of EOL - but "modern" software reading line based information from a text file shouldn't care a damn what the line separator is - the system will code (and normally with pretty much anything). You actually have to work hard to decide it isn't exactly what you want and add an error to specifically tell the user that, but then leave out saying what the problem is! :laugh: We've had PC's for nearly half a century now. This kind of crap is just unacceptable in professional software, like failing to check numeric inputs and assuming the user didn't hit a wrong key ... It's like a car designer putting the fuel tank so that the filler neck snapped in a rear end collision (Ford Pinto, 1970-80) in this century. He'd be vilified today!

                    "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony AntiTwitter: @DalekDave is now a follower!

                    "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
                    "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

                    P 1 Reply Last reply
                    0
                    • R Rage

                      Ah, I see you wrote a small application - I used to do that also, when I was still in development. :-D Today, Text editor -> Ctrl+H -> replace "\r\n" with "\n" :sigh:

                      Do not escape reality : improve reality !

                      S Offline
                      S Offline
                      Stuart Dootson
                      wrote on last edited by
                      #17

                      I still am in development & *I'd* be using my editor (VSCode, where you just click on the 'line ending' item in the status bar and choose LF or CRLF...)

                      Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p

                      1 Reply Last reply
                      0
                      • P PIEBALDconsult

                        While I essentially agree, why blame Microsoft rather than Google? They're actually equally to blame, but Google erred first. Besides, saying that the line terminator is \r\n is still imprecise; a line begins with \n and ends with \r . Get everything from the \n to the \r and you know you have a full and complete line; if not, you may have an incomplete line. (Of course, you also have to honor quotes and escapes.) Well, that and that it should be \n\r , but that's a different issue. Would you also like to argue the issues involved in the lack of a proper CSV standard? Just five minutes? Or the full half hour? Oh, wait, I also need to mention the superiority of the OpenVMS' file system...

                        K Offline
                        K Offline
                        kalberts
                        wrote on last edited by
                        #18

                        PIEBALDconsult wrote:

                        Besides, saying that the line terminator is \r\n is still imprecise; a line begins with \n and ends with \r .

                        Actually, the ISO standard 646, and its followers that include ISO 646 as a subset, defines CR and LF as completely orthogonal functions. LF advances the vertical position by one line, explicitly stating that the horizontal position is not affected. CR sets the horizontal position back to the start of the line, explictly stating that the vertical position is not affected. So from an ISO 646 point of view, CR LF and LF CR are equally valid. Also valid is making two blank lines before the following text as [preceeding text]LF LF LF CR[following text]. What gets you to the beginning of a line is the CR. So it would be more correct to say that CR starts the line. If your file contains xxxyyyzzz, it would look like

                        xxx
                        yyy
                        zzz

                        , by the ISO standard. Note that nothing is printed before the yyy and zzz, there are no spaces overwriting previous output, just a change of vertical position. xxx[CR]yyy[CR]zzz would display xxx, yyy and zzz on top of each other. (Whether it appears as a real overprint or as a replacement depends on the physical presentation device.) Whether you call that one line or three lines on top of each other is a matter of definition.

                        1 Reply Last reply
                        0
                        • OriginalGriffO OriginalGriff

                          Did you know that if you export contacts in Outlook CSV format from Google Contacts, Outlook can't read it? :laugh: No, seriously. And why? Because it's stored with "\n" as the line separator instead of "\r\n" and Outlook doesn't like that, not at all. A windows app (Chrome) writes a text-based file that another Windows app (Outlook) can't read because the line terminator is Windows standard rather than it's preferred format. I thought we killed that in the eighties! Guess what, Microsoft? Excel can read it. Excel reads it fine provided it's got any type of line terminator ... :doh: [edit] OK, it's a trivial change:

                                  string inPath = @"C:\\Users\\PaulG\\Downloads\\ToConvert\\Contacts\\GoggleContacts.csv";
                                  string outPath = @"C:\\Users\\PaulG\\Downloads\\ToConvert\\Contacts\\GoggleContacts2.csv";
                                  string\[\] lines = File.ReadAllLines(inPath);
                                  string appended = String.Join("\\r\\n", lines);
                                  File.WriteAllText(outPath, appended);
                          

                          but it shouldn't be necessary, not at all ... not this century. [/edit]

                          "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony AntiTwitter: @DalekDave is now a follower!

                          D Offline
                          D Offline
                          dandy72
                          wrote on last edited by
                          #19

                          The export was done by Google Contacts (I'm assuming) on Windows, targeting very specifically a Windows app (Outlook), and it doesn't respect the standard CR/LF pair that's ubiquitous on Windows. Who's to blame for that one?

                          1 Reply Last reply
                          0
                          • OriginalGriffO OriginalGriff

                            Yes, I agree that Google are wrong as well, they should be letting the system take care of EOL - but "modern" software reading line based information from a text file shouldn't care a damn what the line separator is - the system will code (and normally with pretty much anything). You actually have to work hard to decide it isn't exactly what you want and add an error to specifically tell the user that, but then leave out saying what the problem is! :laugh: We've had PC's for nearly half a century now. This kind of crap is just unacceptable in professional software, like failing to check numeric inputs and assuming the user didn't hit a wrong key ... It's like a car designer putting the fuel tank so that the filler neck snapped in a rear end collision (Ford Pinto, 1970-80) in this century. He'd be vilified today!

                            "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony AntiTwitter: @DalekDave is now a follower!

                            P Offline
                            P Offline
                            PIEBALDconsult
                            wrote on last edited by
                            #20

                            OriginalGriff wrote:

                            professional software

                            I thought we were discussing Microsoft and Google?

                            1 Reply Last reply
                            0
                            • J Jorgen Andersson

                              Since were all programmers: Open the file in VS, File -> Advanced Save options...

                              Wrong is evil and must be defeated. - Jeff Ello

                              R Offline
                              R Offline
                              Rage
                              wrote on last edited by
                              #21

                              Jörgen Andersson wrote:

                              were all programmers

                              Almost all, Jörgen, almost...

                              Do not escape reality : improve reality !

                              J 1 Reply Last reply
                              0
                              • R Rage

                                Jörgen Andersson wrote:

                                were all programmers

                                Almost all, Jörgen, almost...

                                Do not escape reality : improve reality !

                                J Offline
                                J Offline
                                Jorgen Andersson
                                wrote on last edited by
                                #22

                                True, I understand some are managers.

                                Wrong is evil and must be defeated. - Jeff Ello

                                1 Reply Last reply
                                0
                                Reply
                                • Reply as topic
                                Log in to reply
                                • Oldest to Newest
                                • Newest to Oldest
                                • Most Votes


                                • Login

                                • Don't have an account? Register

                                • Login or register to search.
                                • First post
                                  Last post
                                0
                                • Categories
                                • Recent
                                • Tags
                                • Popular
                                • World
                                • Users
                                • Groups