0

When using org-protocol capture URLs on Windows, pages with non-ASCII titles or captured text results in a capture with incorrect values applied in the template. Despite such characters being properly URL-encoded in the capture URL, Emacs does not decode them back to valid Unicode characters. Despite this, the file to which the captures are sent is properly UTF-8 encoded, and doing a copy/paste of the text that gets mangled via the capture URL into the buffer works as expected.

A couple examples that I whipped up to demonstrate:

  • Example 1
    • URL: https://www.branah.com/japanese
    • Capture URL: org-protocol://capture?template=L&url=https%3A%2F%2Fwww.branah.com%2Fjapanese&title=Japanese%20Keyboard%20-%20%E6%97%A5%E6%9C%AC%E8%AA%9E%E3%81%AE%E3%82%AD%E3%83%BC%E3%83%9C%E3%83%BC%E3%83%89%20-%20Type%20Japanese%20Online&body=
    • Title: Japanese Keyboard - 日本語のキーボード - Type Japanese Online
    • Captured as: Japanese Keyboard - ????????? - Type Japanese Online
  • Example 2
    • URL: https://www.washingtonpost.com/history/2021/05/03/dominos-pizza-noid-returns/
    • Capture URL: org-protocol://capture?template=L&url=https%3A%2F%2Fwww.washingtonpost.com%2Fhistory%2F2021%2F05%2F03%2Fdominos-pizza-noid-returns%2F&title=Domino%E2%80%99s%20Pizza%20Noid%3A%20Return%20of%20the%20mascot%20that%20drove%20a%20man%20to%20take%20hostages%20in%201989%20-%20The%20Washington%20Post&body=
    • Title: Domino’s Pizza Noid: Return of the mascot that drove a man to take hostages in 1989 - The Washington Post
    • Captured as: Domino\222s Pizza Noid: Return of the mascot that drove a man to take hostages in 1989 - The Washington Post

I am running 27.2 on Windows 10, with Org 9.4 via ELPA.

Update: Calling emacsclientw or emacsclient directly with such org-protocol URLs seems to work just fine. Windows appears to be passing the decoded URL to emacsclientw.

1 Answer 1

0

Because Windows itself decodes the URL, emacsclient gets in its arguments something that it can't really make heads or tails of. The solution (at least for now) is a wrapper application that re-encodes the URL and passes that in to emacsclient.

I just created such a program, and it seems to work: org-protocol-w32-handler

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.