When printing plain text files, you might be confronted with all sorts of incompatibilities;
This type of trouble is often referred to as 'alphabet soup' or 'Mojibake'.
There is a way to avoid all this trouble;
For this I created a UTF-8 TXT printqueue;
From /etc/printcap;
txt|UTF-8 txt:\ :lp=/dev/null:\ :sd=/var/spool/lpd/txt:\ :if=/usr/local/bin/utxt-local:\ :mx#0:\ :sh:
A slightly different syntax (lprng);
txt|UTF-8 txt:\ :lp=/dev/null:\ :sd=/var/spool/lpd/txt:\ :if=/usr/local/bin/utxt-local:\ :mx=0:\ :sh:
This printcap entry sends the data to the script 'utxt-local';
#!/bin/bash # This script converts UTF-8 txt to postscript uniprint -printer lp -size 8 -hsize 0 -font /usr/share/fonts/truetype/freefont/FreeMono.ttf
'uniprint', which is in Debian package 'yudit', converts the text to postscript using a True Type Font. This data is then send to the postscript queue (on this system 'lp' is the postscript queue).
You can use any (monospaced) True Type Font for this;
uniprint -printer lj -size 8 -hsize 0 -font /usr/share/fonts/truetype/ttf-dejavu/DejaVuSansMono.ttf
You can even specify more than one font, creating a virtual font;
uniprint -printer lp -size 8 -hsize 0 \ -font /path/to/1st-font.ttf \ -font /path/to/2nd-font.ttf
See 'man uniprint' for more info.
The same can be done with paps;
#!/bin/bash # This script converts UTF-8 txt to postscript paps | lpr
Sometimes you need to specify the prinqueue;
#!/bin/bash # This script converts UTF-8 txt to postscript paps | lpr -P lj
Paps does a much better job than cups' texttops.
These setups do not depend on gs fonts, the printer's build-in fonts or the printer's default character set.