Re: problem w/ text item delimiters
Re: problem w/ text item delimiters
- Subject: Re: problem w/ text item delimiters
- From: kai <email@hidden>
- Date: Wed, 7 Feb 2007 14:01:43 +0000
On 6 Feb 2007, at 22:39, Stockly, Ed wrote:
Here's a version of your script that clearly identifies a problem,
and it's got me stumped also.
I've been using text item delimiters for years but have never seen
this one.
As Tom has mentioned, the issue in this particular case is caused by
a failure to coerce a list of references to text. (The behaviour has
long been thus and certainly predates Mac OS X.) However, there
should be no need to perform individual coercions/evaluation, since
dereferencing can normally be carried out on the entire list:
--------------
set l to {"a", "b", "c"}
repeat with i in {"x", "y", "z"}
set l's end to i
end repeat
{l as string, l's contents as string}
-->{"abc", "abcxyz"} (* assuming tid value is {""} *)
--------------
If a coercion failure occurs, a partial result (up to the point of
the failure) is usually returned; hence the "abc" resulting from the
first case above.
However, I'm not convinced that this is quite the same problem as
that originally experienced by Tim. There, the devil is probably in
the detail (the unspecified code represented by the ellipsis "...") -
since his routine works in some cases and not in others.
My guess is that part of the text was imported from elsewhere, as
Unicode text - and that the failure occurs when it contains Unicode
characters not handled by the system's primary encoding. Workarounds
might include pre-coercing the imported text, progressive
concatenation or partial concatenation (the latter two implicitly
performing the former).
Something like this might help to demonstrate what I mean:
--------------
set utxt to «data utxt23CE» as Unicode text
set str1 to "Start"
set str2 to "Early"
set str3 to "Late"
set str4 to "End"
{|no pre-coercion|:{str1, str2, utxt, str3, str4} as string, |pre-
coercion|:{str1, str2, utxt as string, str3, str4} as string, |
progressive concat|:str1 & str2 & utxt & str3 & str4, |partial
concat|:({str1, str2} as string) & utxt & {str3, str4}}
--> {|no pre-coercion|:"StartEarly", |pre-coercion|:"StartEarly?
LateEnd", |progressive concat|:"StartEarly?LateEnd", |partial
concat|:"StartEarly?LateEnd"}
--------------
Whether or not this relates to the original issue is, of course, pure
speculation...
---
kai
_______________________________________________
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/mailman//archives/applescript-users
This email sent to email@hidden