This shell script takes the contents of the clipboard, then converts it using pandoc, then pastes the output back to the clipboard. The problem is that unicode characters get mangled:
Input: An—emdash
Output: AnÑemdash
If I run the same command from my terminal, the output is fine:
Note -d text-refs is a local config, you should be able to get the same result if the pandoc command is pandoc -f markdown -t plain. In the terminal unicode is preserved, but in BTT the output wrongly encoded...
I think I solved this. The technical background is that BTT runs scripts in an empty environment, not the user's environment. That means no shell setup is available. So the $LANG variable is empty, and thus the encoding problem (I think it defaults to latin1, surely utf8 should be default by now!?). The solution is to define $LANG, so the script would be: