• 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: Weird reply in Tiger vs. Leopard....is this a bug?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Weird reply in Tiger vs. Leopard....is this a bug?


  • Subject: Re: Weird reply in Tiger vs. Leopard....is this a bug?
  • From: "Mark J. Reed" <email@hidden>
  • Date: Tue, 15 Jan 2008 09:34:23 -0500

On Jan 14, 2008 7:58 PM, Jim Skibbie <email@hidden> wrote:
>  If you run a chunk of the script that looks like this...
>
>  set x to do shell script "echo 'All Natural\\nIce
> Cream\\nVanilla\\nChocolate Chip Cookie Dough\\n' | ruby -p -e '$_.strip!'"

Just to be clear: at no point will those sequences be actual newlines.
 Is that the intent?

>  However, in Script Editor and if run from the Contextual menus (where this
> script runs), the reply is:
>
>  All NaturalIce CreamVanillaChocolate Chip Cookie Dough

Also true if run via osascript.

>  Any thoughts?

Seems to be a general bug in Applescript's parsing of the result of
"do shell script".  The sequence '\n' is being interpreted and
translated - which shouldn't be happening at all, but is in any case
being done incorrectly, since it is turning into a return instead of a
newline.  Simple test case:

set x to do shell script "echo '\\n'"

Applescript turns the string into

echo '\n'

The echo command does not do any translation, so the output is

\n

So AppleScript should set x to the two-character sequence backslash
(character id 92) followed by 'n' (character id 110).  Instead, it
sets it to return (not newline, oddly).  Other backslash sequences are
also interpreted ('\t' becomes a tab), while unrecognized ones are
left alone ('\x' stays as a two-character sequence).   '\r' also
becomes return, but if it's the last thing in the output it is removed
entirely (newline canonicalization run amok, I suppose).

I've filed a bug (#5688393).  You should probably do likewise...


--
Mark J. Reed <email@hidden>
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

  • Follow-Ups:
    • Re: Weird reply in Tiger vs. Leopard....is this a bug?
      • From: Jim Skibbie <email@hidden>
References: 
 >Weird reply in Tiger vs. Leopard....is this a bug? (From: Jim Skibbie <email@hidden>)

  • Prev by Date: Weird reply in Tiger vs. Leopard....is this a bug?
  • Next by Date: make new folder ?
  • Previous by thread: Weird reply in Tiger vs. Leopard....is this a bug?
  • Next by thread: Re: Weird reply in Tiger vs. Leopard....is this a bug?
  • Index(es):
    • Date
    • Thread