While trying to send a text file to the printer via lpr
from xterm
, the content was corrupted beyond recognition, the cause of which was ultimately traced to the encoding of the file. If I instead process the text with iconv
(e.g., iconv -f utf-8 -t ascii//TRANSLIT
), then the file is printed normally. Another suggestion I came across is setting the document format (e.g., lpr -o document-format=text/utf8
), but this returns the error lpr: Unsupported document-format "text/utf8"
. I could always alias the lpr
command to include processing by iconv
, but is there a more general way for native utf-8 support in the CUPS
/lpr
system?
Edit: My OS is Debian 8 and my window manager is openbox
(no desktop environment). I can print this file without any problem from MacOS X as well as from a Debian7/Gnome3 system.
From my current system, I should point out that even after changing character encoding from UTF-8 to ASCII, the newline characters are not respected by lpr
, so the lines are concatenated together and printed until the paper margin is reached. After recoding and transliteration with iconv
on MacOS X, the printing still works normally (so the newline issue is also specific to my current system).
a2ps
? What encoding is really used on output, when you try utf-8? (I guess it'siso-8859-1
)a2ps
filter. I was not aware of it. The printer in question is an HP4650 scanning laser printer. How can one determine the encoding used byCUPS
? The characters actually printed, which bear no discernible relation to the input, included a Greek capital gamma, a capital C with a cedilla, an o with a circumflex, and a Latin capital W and T. Beyond this the failure to respect newline characters results in truncation of output at the paper margin.lpr -o document-format='text/plain;charset=utf-8'
will be enough to print as you want, but this doesn't change your CUPS installation default which seems obsolete.