Re: linebreak in a shell script; was Re: What's wrong with this call to zip?
Re: linebreak in a shell script; was Re: What's wrong with this call to zip?
- Subject: Re: linebreak in a shell script; was Re: What's wrong with this call to zip?
- From: Shane Stanley <email@hidden>
- Date: Sat, 01 Mar 2008 21:54:11 +1100
- Thread-topic: linebreak in a shell script; was Re: What's wrong with this call to zip?
Just to round this topic off:
AppleScript 2.0's treatment of a CRLF pair as a single character with two
code points is as designed. I don't know if the change will affect many
scripts; I doubt it.
The fact that text item delimiters do not recognise a linefeed in a CRLF
grapheme cluster as a single code point is not as designed but is a bug.
Text item delimiters are meant to look at individual code points.
That is to say, this works:
set x to "blah" & return & linefeed & "blah"
set AppleScript's text item delimiters to {return}
set z to count of text items of x --> 2
But this returns a count of 1:
set x to "blah" & return & linefeed & "blah"
set AppleScript's text item delimiters to {linefeed}
set z to count of text items of x --> 1; should be 2
It seems that text item delimiters don't look beyond the first code point in
a cluster (the bug is not specific to CRLF).
I can see this bug breaking quite a few older scripts, unfortunately.
--
Shane Stanley <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