trying remove text from a string, but result is a list of characters

I have a filepath that I am trying to reduce (to remove “/Volumes/” from the start of the POSIX path). I am setting a variable to the POSIX path then using AppleScript’s text delimiters set to “/Volumes/” I’m trying to grab the 2nd text item. I expected that this would take something like “/Volumes/SomeDrive/folder/file” and turn it into “SomeDrive/folder/file” but instead I’m getting a single character.

repeat with i from 1 to number of items of thePOSIXItemPaths
	set thisItem to item i of thePOSIXItemPaths as string
	-- remove the Volumes and volume name from the path and replace with the destination folder
	set AppleScript's text item delimiters to {"/Volumes/"}
	set thisItemFile to item 2 of thisItem
	set thisItemDestination to (destinationFolderPOSIX & thisItem) as string
end repeat

If I set thisItemFile to items 2 through -1 of thisItem then I get all the remaining characters from my path, but the result is a list of the individual characters instead of the string I’m expecting.

I notice in Script Debugger that the text is UTF-16, is this causing this behavior?

A couple of things wrong here; First it is always good practice to save the current text item delimiters (it is a universal AppleScript property) and restore them afterwards, and second you want text items, not text.

repeat with i from 1 to number of items of thePOSIXItemPaths
	set thisItem to item i of thePOSIXItemPaths as string
	set tid to AppleScript's text item delimiters -- they are remembered
	-- remove the Volumes and volume name from the path and replace with the destination folder
	set AppleScript's text item delimiters to {"/Volumes/"} -- the braces are not strictly necessary.
	set thisItemFile to text item 2 of thisItem
	set AppleScript's text item delimiters to tid -- so set them back.
	set thisItemDestination to (destinationFolderPOSIX & thisItem) as string
end repeat

Thank you for the corrections.

Now that I’ve already stomped the original text delimiters what should I set them to so I can return them to their original value? Right now the “original” value is the value I was setting previously.

The default value for text item delimiters is {“”} (list with the empty string as its only item). You can usually get the default value back by restarting the host application that provides the AppleScript execution context.

If you have only been running the scripts in Script Editor, you can restart it to reset text item delimiters.
If you have been running them from an app launcher like FastScriptsp, restart that.
If you have been running them from the standard Script menu bar addition, you will need to restart System Events (tell app “System Events” to quit; I think it should be safe fairly to do this. It will be restarted the next time something needs it.).
For scripts saved as applet bundles, just restarting the app should be enough (the value does not seem to be persisted across restarts like other top-level script properties are for applets and applet bundles).

If you have only been running the scripts in Script Editor

You can normally run set AppleScript’s text item delimiters to “” in a new script, rather than restarting.
And when testing a script with AppleScript’s text item delimiters I place it as the first line, which always resets it after I run into an error.
Saves you from having to close all you open scipts