When I enter this in script editor:
set x to "/a/b/c/Jack's trip.jpg" quoted form of x
I get this:
"'/a/b/c/Jack'\\''s trip.jpg'"
Disregarding the main enclosing double quotes (which always appear when the editor displays a string value), and parsing the backslashes, this should translate to this, right?
'/a/b/c/Jack'\"s trip.jpg'
Am I missing something? I can't make any sense out of this, and I doubt it would work as a valid POSIX path. And how did that double quote get stuck in the middle of the string?
Now try the same code in a "Run AppleScript" block in Automator:
on run {input, parameters}
set x to "/a/b/c/Jack's trip.jpg" return quoted form of x end run
Guess what gets returned. This:
'/a/b/c/Jack'\''s trip.jpg'
which is the same as my "decoded" form of Script Editor's result, but still doesn't make any sense that I can see.
It seems to me the correct encoding should be this:
'/a/b/c/Jack\'s trip.jpg'
Am I wrong? What does it all mean? |