To copy text of AppleScript on the web could be a different experience.
Lets talk about apostrophe or what other maybe will call right single quotation mark.
Unicode prefer the later one but not AppleScript code.
The problem is when users use right single quotation mark in AppleScript code, it will not compile.
Apostrophe (typewriter apostrophe) is more commonly used and that is what AppleScript code support.
If you copy applescript:// link and paste to Editor you will find its use %27 in other words
it use UTF-8 27 (U+0027) apostrophe and not right single quotation mark UTF-8 E2 80 99 (U+2019)
In the AppleScript Language Guide PDF form you will see they use single quotation mark
for text (description) and for AppleScript code text it use apostrophe (U+0027)
Still there are people who write AppleScript code for the web that use right single quotation mark.
The question is, why…
And Smart Quotes have never work in Script Editor and is more confusing why its there.
Script links make it easy for converting unsupported text (AppleScript code) to friendly
AppleScript code. And the difference could be compile without error vs compile with error.
Copy/paste of web text is not always working and above give you some hints why.
In the one available on my machine, current text use - logically - LEFT DOUBLE QUOTATION MARK ( U+201C) and RIGHT DOUBLE QUOTATION MARK (U+201D).
In the code samples - logically - they use QUOTATION MARKs (straight double quotes, U+0022).
In my own messages, sometimes I use both.
The typographical curly double quotes are used as delimiters enclosing text which contains the QUOTATION MARKs.
For instance, yesterday I posted a message embedding :
replace all “\r\n” by ““&return&linefeed&””
replace all “\r” by ““&return&””
replace all “\n” by ““&linefeed&””.
What sometimes bored me is the fact that, according to the application used to create messages, from time to time, in blocks of code, a QUOTATION MARK is replaced by a RIGHT or a LEFT DOUBLE QUOTATION MARK.
In such case, the Script Editor refuse to compile but happily, most of the time, it highlight the offending character.
Yvan KOENIG running High Sierra 10.13.6 in French (VALLAURIS, France) vendredi 29 janvier 2021 16:30:33
On page 207 in AppleScript Language Guide from 2013
This is ex of description not source code.
The current user’s short name
The current user’s long name
The current user’s user ID
This is right single quotation mark is not supported in AppleScript source code when compiling.
You couldn’t do:
ex.
set a to "hello"
a’s class
Every example of source code in AppleScript Language Guide use apostrophe and that is supported.
My point with this topic was when we write source code of any scripting or programming language
it makes sense to know what that specific language do support because if we do not.
Copy/paste of any text of source code could fail and return error. And that is not maybe
what the author of source code had in mind.
When Applescript was created, the allowed characters were only the ASCII (lower than 129) ones.
It’s not surprising that other characters aren’t accepted as operators.
I use daily smart quotes but I never activated the Smart Quotes preference because I know that AppleScript doesn’t accept such characters as components of its syntax.
When I want to type a curly quote I press alt + double quote or single quote, with or without shift depressed to get the correct orientation.
Back to the User Guide, curly single quotes are used in ‘standard’ text, straight single quotes are used as possessive shortcut in code samples.
set a to "hello"
a's first character --> "h"
a's last character --> "o"
-- set b to 'hello' -- can't compile
Yvan KOENIG running High Sierra 10.13.6 in French (VALLAURIS, France) vendredi 29 janvier 2021 20:44:40
I good example of unsupported character is Takaaki AppleScript Website… http://piyocast.com/as/
Its not possible to copy/paste… directly into Script Editor without compile error.
And other websites have similar experience or include line numbers in the source code.