Open a URL with parameterized query arguments (URL-encode)
You have lots of requirements, which makes for a slightly convoluted solution:
open fafapp://find?loc=$(python -c &quot;import urllib, sys; print urllib.quote(sys.argv[1])&quot; &quot;$path&quot;)&amp;inp=$(python -c &quot;import urllib, sys; print urllib.quote(sys.argv[1])&quot; &quot;$what&quot;)

This uses python, which is pre-installed on macOS 10.11 and later (including Big Sur). It is also a one-liner (although a long one).