4

The -K option allows me to specify my troff file's encoding, but this does not seem to extend to macro files. If a custom macro file contains non-ASCII characters in a string, the output looks like this:

Mit freundlichen GrüÃen,

My setup looks like this:

# letter_to_doe.tr
.recipient John Doe
.text Sehr geehrter Herr Doe ...
# letter.tmac
.de recipient
.\" ...
..
.de text
.\" ...
..

Mit freundlichen Grüßen

How can I properly convert the non-ASCII characters in the tmac file?

0

1 Answer 1

4

Convert your macro file with preconv -e utf8 to replace all UTF-8 characters with troff markup.

With the example case that you show, I would put the letter macros in letter.tmac.in and then create letter.tmac from this with

preconv -e utf8 letter.tmac.in >letter.tmac

This would replace the problematic line

Mit freundlichen Grüßen

with

Mit freundlichen Gr\[u00FC]\[u00DF]en

... in the generated file.

This would be a one-time conversion you need to do whenever your macro file is updated. It would lend itself perfectly to be a rule in a Makefile:

letter.tmac: letter.tmac.in
        preconv -e utf8 letter.tmac.in >letter.tmac
0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .