3 of 3 edited tags; edited tags

How do I process text before I hand it over to enscript? (Or how do I print UTF8 Mutt messages to PDF?)

I'm trying to use enscript to print PDFs from Mutt, and hitting character encoding issues with curly quotes. So that an email with text like this:

“very dirty”    

Comes out as:

â\200\234very dirtyâ\200\235

My print script currently reads like this:

#!/usr/bin/env sh
INPUT="$1" PDIR="$HOME/Desktop" OPEN_PDF=evince

tmpfile="`mktemp $PDIR/mutt_XXXXXXXX.pdf`"
enscript --font=Courier8 $INPUT -2r --word-wrap --fancy-header=mutt -p - 2>/dev/null | ps2pdf - $tmpfile
$OPEN_PDF $tmpfile >/dev/null 2>&1 &
sleep 1
rm $tmpfile

Is there a way to replace the curly quotes before I send it to enscript? Or a character encoding I can use that will handle the quotes?

If there's another (better?) way to print to PDF from Mutt, I'm all ears. I just need to ensure that my quotes aren't getting fouled up.