3

I have a troff document (manpage) with UTF-8 characters and I am trying to convert it to a PDF. However, when using the -Tpdf option, the PDF generated does not show the correct characters. This is the command I am using:

groff -k -Tutf-8 -pet -Tpdf -mandoc filename.1 > filename.pdf

Examples of what goes wrong:

"Používá" becomes "Pou3⁄4ívá"
"překladač" becomes "pøekladaè"
"prováděných" becomes "provádìných"
"rozšířením" becomes "roz1íøením"

How to do it correctly?

  • 1
    Are you sure you want -Tutf-8? From a glance at the manual, it seems like your two -T options might be conflicting, and -D is used to select a charset – Fox Apr 25 '17 at 20:13
  • Ah, sorry, I am not sure, I was just already very desparate. Using -D utf-8 makes the problematic characters disappear completely, resulting in 'can't find special character' warnings – magnusi Apr 25 '17 at 21:34
  • 1
    What about -K utf-8? – Gilles Apr 25 '17 at 22:06
  • I'm testing things now. Interestingly, if I use -D utf-8 or -K utf-8 along with -T utf-8, I can see the Czech symbols, but when I change -T utf-8 to -T ps or -T pdf the problem arises. So grotty acts fine with Unicode, but grops and gropdf are having trouble – Fox Apr 25 '17 at 22:38
  • 1
    See also The Linux Documentation Project stating that groff -Tps is only capable of outputting the Unicode characters that "PostScript supports by itself" (though it doesn't specify which version of groff). Since PDF is just compiled PostScript, this is probably the issue. – Fox Apr 25 '17 at 23:10
1

The following convoluted way works:

groff -Kutf8 -Tdvi -mec -ms test.ms > test.dvi
dvipdfm -cz 9 test.dvi
open test.pdf

Via the [Groff] latin2 polish special characters thread on lists.gnu.org.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.