I have realized that only a half of new apostrophes in doc strings were properly escaped, so I am attaching updated patch. I still consider the change as a minor improvement. On 06/04/2021 21:47, Maxim Nikulin wrote: > > When I tried org-protocol for the first time, I was quite surprised that > query parameters generated using URLSearchParams JavaScript class are > decoded incorrectly. "+" characters representing space are passed as is. > I hope, I have found a proper place in the code to handle such case. > > It does not affect previously recommended bookmarklets with abundant > calls of encodeURIComponent that escapes spaces as "%20". I believe, new > option is more readable: > >     javascript:location.href='org-protocol://capture?' + >         new URLSearchParams({ >             template: 'x', >             url: location.href, >             title: document.title, >             body: window.getSelection()}); > > I guess, with old org-protocol syntax only pure percent encoding was > necessary due to each parameter was represented as path component. "+" > is allowed only in query part. Such variant was just missed when new > query-like syntax was introduced.