I have been using the standard JavaScript encodeURIComponent
to create omniJS URLs, apparently without problem, so I was interested to notice, at:
https://omni-automation.com/script-links.html
A script roughly along ES6-equivalent lines of:
// encodeForOmniJS :: String -> String -> String
const encodeForOmniJS = (OmniAppName, scriptCode) =>
OmniAppName.toLowerCase() + ":///omnijs-run?script=" +
"'()!~.".split('')
.reduce((a, x) =>
a.replace(
RegExp('\\' + x, 'g'), '%' + (x.charCodeAt(0)
.toString(16)
.toUpperCase())
),
encodeURIComponent(scriptCode));
Which adds a second pass after encodeURIComponent
– also encoding the six extra characters: '()!~.
Should I be doing this too ? (These are characters which don’t usually need encoding in a URL)