Circumflex (^) bug?? Workaround only spaces??

Run this little script and you’ll see that the middle dialog is incorrect, while the first and third are fine. Is this a bug with circumflexes? What’s going on?

display dialog "^" --> ^

display dialog "X^2" --> X

display dialog "X ^ 2" --> X ^ 2

Very strange, Adam.

Everything seems to work fine as a string, it’s just display dialog; Also, from what I just tried, it only happens when the numbers 0, 1, 2, and 3 immediately follow the circumflex (as text).

--{"A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"}
{"1", "2", "3", "4", "5", "6", "7", "8", "9", "0"}

repeat with thisItem in result
	display dialog "Hello ^" & thisItem & " World"
end repeat

Maybe ^0 - ^3 are certain reserved placeholders like the %-sign in the localizable.strings.
I don’t know, I’m only guessing :slight_smile:

Hi, Adam.

This came up on the AppleScript-Users list some time ago. I can’t find the details at the moment, but I think Stefan’s right. It’s something to do with the fact that “^0”, “^1”, “^2”, and “^3” are used to mark text substitution points in calls to in Mac OS’s low-level text handling subroutines. For some reason ,‘display dialog’ doesn’t allow for these. The workround is to split the circumflex from the following digit “ either inserting a space, as you’ve done, or an invisible character:

display dialog "X^" & (ASCII character 0) & "2"

Adam, you posted this before, on the mailing list and there was a post here.


Thanks Nigel & Kel. NOW I remember having seen and read about this problem before :rolleyes:. Alzheimers is clearly setting in. :o That it was my own question, however, is a bit daunting. :frowning:

The solution, as proposed by Nigel, is to define a new character:

property NE : "^" & (ASCII character 0)

and use that where you need contiguous: X^2 in a dialog.