mailcap on Windows WSL

Michael Kjörling ba47c4919fb5 at ewoof.net
Tue Oct 8 08:26:35 UTC 2024


On 8 Oct 2024 08:55 +0200, from mutt-users at mutt.org (Jan Eden via Mutt-users):
> I need to use mutt within the WSL of MS Windows. To display HTML
> mails via mailcap, I created a small script which reads from STDIN,
> writes a temporary file and opens it with the Edge browser:
> 
> # ~/.mutt/mailcap
> text/html; ~/.mutt/htmlviewer html
> 
> # ~/.mutt/htmlviewer
> with open('/var/tmp/htmlfile', 'w') as tmp_file:
> 	for line in sys.stdin:
> 		tmp_file.write(line)
> 
> This works for some messages, but for others, a UnicodeEncodeError is
> returned:

Try using something not quite as clever.

#!/bin/sh
cat - >/var/tmp/htmlfile
[whatever you need to do to open it in Edge goes here]

An alternative might be to offload to something like xdg-open or
Windows' "start" from within the mailcap, if you can do that from
within WSL; with or without "needsterminal" in the mailcap.

-- 
Michael Kjörling                     🔗 https://michael.kjorling.se
“Remember when, on the Internet, nobody cared that you were a dog?”



More information about the Mutt-users mailing list