using 'do shell script' with funny characters in folder name

has anyone written some conversion code in AS to convert folder names that contain spaces and other funny characters (like äöü) in a way the terminal understands it?

A folder name like “…:Schöner Ordner:” nets to be converted into “…/Sch303266ner Ordner/” in order to work with Terminal and ‘do shell script’

I think someone must have writen a converter for this!



It’s built into AppleScript, using ‘quoted form of’ a string:

set theDir to "My Disk:Schöner Ordner:"
do shell script "ls " & quoted form of theDir

AppleScript uses the backslash for escape characters.

" - quote
\ - backslash