• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: carriage return & line feeds
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: carriage return & line feeds


  • Subject: Re: carriage return & line feeds
  • From: Christopher Nebel <email@hidden>
  • Date: Fri, 8 Jun 2001 12:29:41 -0700

On Friday, June 8, 2001, at 10:19 AM, Arthur J Knapp wrote:

Chris Nebel wrote:
Unix: ASCII character 10 (aka "\n" to Perl and C users, aka line feed)

Hey, you leave Perl out of this!

and clarify things a little: "\n" is platform *dependent* in Perl, and
adjusts itself nicely when reading/writing files on mac/unix/windows. Very
helpful for writing platform *independent* scripts involving file I/O. "\n"
is ascii character 10 in Perl only on unix platforms.

JavaScript OSA is the same way. Personally, I find it confusing.

I genuinely didn't know about this behavior in Perl. No slight intended; I have a lot of respect for Perl, even if it does look like line noise sometimes. ;) The solution to Arthur's problem, at least in languages that support it, is to use the raw ASCII value: if you want a line feed no matter what, you say "\012" or "\0x0a". I'd like to add a general character-escaping scheme to AppleScript, but it's been a relatively low priority.

Decent script editors don't change escaped-characters into their
literal format:

set someString to "Hello\rWorld"

-- after compile:

set someString to "Hello
World"

I mean, it kind of defeats the whole purpose of escaping in the
first place, doesn't it?

<Cough.> Yes, I'm aware of the problem. It bugs me, too. The problem is, what if you put a literal return in there in the first place? It would be rude to turn it into "\r", but we don't currently have a way to track exactly what you typed. I'll have to think more about that, but I suspect it's unmanageable. Maybe a preference somewhere...


--Chris Nebel
AppleScript Engineering


References: 
 >Re: carriage return & line feeds (From: Arthur J Knapp <email@hidden>)

  • Prev by Date: Re: Dropping text on to Droplets
  • Next by Date: Newbie Question - Hidden Password
  • Previous by thread: Re: carriage return & line feeds
  • Next by thread: Re: carriage return & line feeds
  • Index(es):
    • Date
    • Thread