Article View: linux.debian.bugs.dist
Article #586Bug#878142: muttprint: some non-ASCII characters are silently missing from the generated .ps file
From: Edmund Christian Herenz
Date: Mon, 12 Oct 2026 12:00
Date: Mon, 12 Oct 2026 12:00
159 lines
7945 bytes
7945 bytes
--76i73lsczot7nqay
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Hi,
this bug is paining me since forever now, and even after tinkering I
don't have the right solution, but a least a solution that works for
me (mostly).
Seeing that this bug now will have it's tenth anniversary soon, and
given that nothing ever will happen upstream anymore with this big
hack for a niche audience, I post my patch here for inspiration.
But, it's not meant to be *the patch* that fixes this bug once and
forever. (Note that the main mono font in my patch is also Julia
Mono, which is not distributed by debian.)
On Tue, 10 Oct 2017 15:55:36 +0200 Vincent Lefevre <vincent@vinc17.net> wrote:
> I think that the easiest solution would be to use xelatex and
> a font that the required characters (DejaVu Sans Mono seems one
> of the most complete fonts).
>
> I've attached a patch that does this (mainly for testing), but
> I haven't tried in non-UTF8 locales (I suppose that the input
> should be converted to UTF8 or \XeTeXinputencoding should be
> used) and the font is hardcoded in the patch.
So this patch did nothing for me, a lot of UTF-8 characters in the
mail body were still rendered as boxes.
In my setting I have to deal with utf-8 mails that contain
mathematical symbols, various Indic scripts, and also Japanese. From
my understanding, there is no one-fits-all UTF-8 rendering solution
that muttprint could use as a template.
For my purpose I now switched to lulatex as the latex backend, and I
come up with some fall-back chain in lua ... the list of fallbacks should be
increased for more general cases maybe?
(Also, some emails that contain a lot of Japanese and rarer characters
still fail to print.)
Here is the way I use muttprint in my .muttrc:
set print_command='set -e; f=`mktemp`; \
/home/edmundherenz/bash-scripts/ciscoclean.sh | muttprint \
--penguin /usr/share/ospics/BabyTuX.png -P A4 -p TO_FILE:"$f"; \
okular "$f"; rm "$f"'
CH.
--
Edmund Christian Herenz
Inter-University Centre for Astronomy and Astrophysics, Pune, India
Phone: ++91 (0)20 25604 109
Web: https://web.iucaa.in/~edmund.herenz/
--76i73lsczot7nqay
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment; filename="muttprint-utf8_v2.patch"
--- a/muttprint
+++ b/muttprint
@@ -177,7 +177,7 @@
my %Header; # Header ...
my @PrintedMailheaders; # Mailheader so wie er gedruckt wird (LaTeX-Code)
my $childPid; # PID des Kinds
-my $DVIopts; # Optionen fuer DVI - Aufruf
+my $PDFopts; # Optionen fuer PDF - Aufruf
my @Command; # Kommando zum Drucken; fuer Druck in Datei
my $Laenge = "0"; # zum Ermitteln der laengsten Zeile
my $MaxLaenge = "0"; # die laengste Zeile
@@ -583,13 +583,14 @@
#
# running latex twice because of the "page ... of ..."
-system("latex -interaction=nonstopmode mail.tex >> $errorRedirection 2>&1");
-system("latex -interaction=nonstopmode mail.tex >> $errorRedirection 2>&1");
+for (1..2) {
+ system("lualatex --jobname=mail -file-line-error -interaction=nonstopmode mail.tex >> $errorRedirection 2>&1");
+}
#
# no check of the exit code because we do this here
-unless (-e $Temp{dvi}) {
- fatalError "Latex didn't work. There's no DVI file. If you ".
+unless (-e $Temp{pdf}) {
+ fatalError "Latex didn't work. There's no PDF file. If you ".
"write a bugreport, please include a mail where printing fails.";
}
@@ -599,8 +600,8 @@
#
# generating the postscript file in every case
-system("dvips -t $paperformat -o $Temp{ps} $Temp{dvi} >> $errorRedirection 2>&1")
- and fatalError "Error while running dvips:\n$!";
+system("pdftops $Temp{pdf} $Temp{ps} >> $errorRedirection 2>&1")
+ and fatalError "Error while running pdftops:\n$!";
# now we find out the number of pages the document has
@@ -1163,11 +1164,11 @@
}
}
- $Temp{dir} = tempdir("muttprint-XXXXXX", TMPDIR => 1, CLEANUP => 1);
+ $Temp{dir} = tempdir("muttprint-XXXXXX", TMPDIR => 1, CLEANUP => 0);
$Temp{content} = "$Temp{dir}/content";
$Temp{latex} = "$Temp{dir}/mail.tex";
$Temp{logf} = "$logf";
- $Temp{dvi} = "$Temp{dir}/mail.dvi";
+ $Temp{pdf} = "$Temp{dir}/mail.pdf";
$Temp{ps} = "$Temp{dir}/mail.ps";
$Temp{psnew} = "$Temp{dir}/mail-new.ps";
$Temp{ps1} = "$Temp{dir}/mail1.ps";
@@ -1386,14 +1387,27 @@
output \*LATEX, "
\\documentclass[compat2,$Config{FONTSIZE}]{article}
-$fontencString
\\renewcommand{\\tt}{\\rm}
\\usepackage[$babellanguage]{babel}
-\\usepackage[$inputcharset]{inputenc}
+\\usepackage{fontspec}
+\\directlua{
+ luaotfload.add_fallback(\"UniversalMailChain\", {
+ \"DejaVuSansMono.ttf:mode=node;\",
+ \"NotoSansCJKJP:mode=node;script=jpan\",
+ \"NotoSansDevanagari:mode=node;\",
+ \"NotoSansTamil:mode=node;\",
+ \"NotoSansArabic:mode=node;\"
+})}
+\\setmonofont{JuliaMono}[Renderer=HarfBuzz,RawFeature={fallback=UniversalMailChain}]
+\\setmainfont{DejaVu Sans}[Renderer=HarfBuzz,RawFeature={fallback=UniversalMailChain}]
+
\\usepackage{$LatexPackages}
\\usepackage[${paperformat}paper,left=$Config{LEFTMARGIN}mm,right=$Config{RIGHTMARGIN}mm,%
top=$Config{TOPMARGIN}mm,bottom=$Config{BOTTOMMARGIN}mm,headsep=5mm]{geometry}
\\usepackage{fancyvrb,graphicx,marvosym,textcomp,array}
+
+\\fvset{fontfamily=tt, breaklines=true}
+
$sansserif
\\setlength{\\parindent}{0mm}
$isolatinextensions
@@ -1434,7 +1448,7 @@
\\begin{document}
\\thispagestyle{plain}",
$BeforeHeader,
-"\\parbox{\\parboxwidth}{{\\large
+"\\parbox{\\parboxwidth}{{\\fontsize{11.5pt}{14pt}\\selectfont
\\begin{tabular}[t]{\@{}r>{\\raggedright}p{$PengTab}\@{}p{0mm}\@{}}";
output \*LATEX, @PrintedMailheaders;
--76i73lsczot7nqay--
Technical Details
Message-ID:
<NNmRb-54bA-5@gated-at.bofh.it>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!news.corradoroberto.it!diesel.cu.mi.it!bofh.it!news.nic.it!robomodReferences:
<uzU03-34a-629@gated-at.bofh.it> <uzUCC-3Jk-363@gated-at.bofh.it> <uzU03-34a-629@gated-at.bofh.it> <uzUCC-3Jk-363@gated-at.bofh.it>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!news.corradoroberto.it!diesel.cu.mi.it!bofh.it!news.nic.it!robomod From: Edmund Christian Herenz <edmund.herenz@iucaa.in> Newsgroups: linux.debian.bugs.dist Subject: Bug#878142: muttprint: some non-ASCII characters are silently missing from the generated .ps file Date: Mon, 12 Oct 2026 14:00:01 +0200 Message-ID: <NNmRb-54bA-5@gated-at.bofh.it> References: <uzU03-34a-629@gated-at.bofh.it> <uzUCC-3Jk-363@gated-at.bofh.it> <uzU03-34a-629@gated-at.bofh.it> <uzUCC-3Jk-363@gated-at.bofh.it> X-Mailbox-Line: From debian-bugs-dist-request@lists.debian.org Mon Oct 12 11:57:12 2026 Old-Return-Path: <debbugs@buxtehude.debian.org> X-Spam-Flag: NO X-Spam-Score: -1.751 Reply-To: Edmund Christian Herenz <edmund.herenz@iucaa.in>, 878142@bugs.debian.org Resent-To: debian-bugs-dist@lists.debian.org Resent-Cc: rene@debian.org X-Debian-Pr-Message: followup 878142 X-Debian-Pr-Package: muttprint X-Debian-Pr-Source: muttprint Dkim-Filter: OpenDKIM Filter v2.10.3 iucaa.in B548BF688791 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="76i73lsczot7nqay" Content-Disposition: inline User-Agent: NeoMutt/20260616 X-Greylist: delayed 1180 seconds by postgrey-1.37 at buxtehude; Mon, 12 Oct 2026 11:56:21 UTC X-Debian-Message: from BTS X-Mailing-List: <debian-bugs-dist@lists.debian.org> archive/latest/1996397 List-ID: <debian-bugs-dist.lists.debian.org> List-URL: <https://lists.debian.org/debian-bugs-dist/> Approved: robomod@news.nic.it Lines: 159 Organization: linux.* mail to news gateway Sender: robomod@news.nic.it X-Original-Date: Mon, 12 Oct 2026 17:06:19 +0530 X-Original-Message-ID: <asy9EN0kFZGM7LeD@office109.tailb6eb9b.ts.net> X-Original-References: <20171010114353.GA10843@cventin.lip.ens-lyon.fr> <20171010135536.GA4005@cventin.lip.ens-lyon.fr> <20171010114353.GA10843@cventin.lip.ens-lyon.fr> <20171010135536.GA4005@cventin.lip.ens-lyon.fr>