What's the simplest way to process files with UTF-8 characters in groff on macOS?

I require Polish diacritics, such as ą, ć, ę, etc.

Of course, I can always pre-process the file to replace UTF-8 characters with escaped characters but that's not elegant.


As of today, macOS Mojave ships with a quite outdated version of groff (1.19 or something...) which apparently cannot handle the -K option. Thus it fails to recognise any fancy diacritics (german umlauts in my case), if you run groff -Kutf8 ....

You can get a newer version of groff on macOS by installing it via Homebrew, as per this post

brew install groff gs

(not sure if gs for ghostscript is actually required; I installed it anyway)


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.