work around URI problems with encoding and resolving. Fixes #725
Test for #723.
Allow -cp argument to 'apply' command to be quoted.  Fixes #724.