There seems to be a bug in the URL encoding. Thanks to gentle prodding by Peter Lewis (KM’s dev), I looked at the url encoding of the file name.
I work mostly in French, and the name of my file was “Problème Bankable”. The URL given by hook is
hook://file/tSfl7TRKH?p=RG9jdW1lbnRzL3Byb2plY3RzX2FyY2hpdmU=&n=proble%CC%80me%20bankable
The issue is that the ASCII encoding of è
should rightly be %E8
, not %CC%80
. And indeed if I replace the latter by the former in the url I pass to Keyboard Maestro, or indeed in any web browser, it works.
As Peter says:
Keyboard Maestro uses the system NSURL API to process URLs, and NSURL requires that the URL be formatted correctly. Incorrectly formatted URLs are not allowed and will not work.
Web browsers are often forgiving in the URLs they will accept, and will accept invalid URLs and translate them as best they can in to valid ones and process them after that translation. Keyboard Maestro will not - the URL must be valid.
It seems that %CC%80
is a “long form” encoding of è
(at least %CC
seems to be a code for “accented”) but this is the limit of my encoding knowledge. All I can say is this seems to be one of those cases where web browsers (and Hook) will manage to figure it out, but not the NSURL API.
EDIT: following a more detailed comment by Peter N. Lewis, the KM dev, it seems that the issue arises because Hook URLs use one form of accents where è
is rendered as e
+ combined grave accent
, whereas it seems that KM expects the single character form (unicode 00E8
). The solution is to turn off a preprocessing toggle in KM