2 Replies Latest reply on Jan 22, 2012 9:15 AM by vze26m98

    Portable LF-CRLFs across Mac/Windows?

    vze26m98

      Surprised I couldn't find the answer to this question easily, so please forgive if it's comon knowledge:

       

      I'm writing text into a multiline ScriptUI textedit box, and of course, the "\n" I've been using in my ExtendScript code works fine on the Mac and not-so-fine of Windows.

       

      Does Adobe provide anything like a portable "newline" constant? Can't seem to find an answer to this.

       

      I know I can quiz for the platform I'm running on, and set a variable to "\n" or "\r\n" accordingly, but is there a more elegant solution?

       

      Thanks so much!

       

      Charles

        • 1. Re: Portable LF-CRLFs across Mac/Windows?
          John Hawkinson Level 5

          Does Adobe provide anything like a portable "newline" constant? Can't seem to find an answer to this.

          No. In the C world, \n is supposed to be translated into \r\n where appropriate on output, I would have thought that was true in Javascript too.

           

          I was kind of under the impression that it was.

           

          Did you try '\r' on both platforms?

          • 2. Re: Portable LF-CRLFs across Mac/Windows?
            vze26m98 Level 1

            Hi John-

             

            Thanks for your response. It seems you are correct.

             

            I got some screenshots from a friend using a compiled script of mine on his Win7/CS5 combo showing that the CRLF translation wasn't working. (I'd built the script on a Mac.)

             

            Today I'm going over my work on XP/CS4, and the LF translation seems fine.

             

            I guess it might have something to do with creating the JSXBIN file on the Mac, and running it on Windows?

             

            Presumably I'll get an answer after I poke around a bit more.

             

            Best wishes, Charles