Re: mailcap on Windows WSL

Michael Kjörling <[email protected]>
Newsgroups gmane.mail.mutt.user
Message-ID <[email protected]>
On 8 Oct 2024 08:55 +0200, from [email protected] (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?”
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.