How to handle accents with enscript

character encodingenscriptsymbol-table

I cannot figure out how to handle accents with enscript when converting a txt into a pdf:

echo "élisée" | enscript  -o - -X <encoding> | ps2pdf - output.pdf

I tried all possible encoding but none are leading to the proper result.

I guess I should add a iconv at the first stdout


List of enscript encoding that I have tried:

  • 88592
  • 88593
  • 88594
  • 88595
  • 88597
  • 88599
  • 885910
  • ascii
  • asciifise
  • asciidkno
  • ibmpc
  • mac
  • vms
  • hp8
  • koi8
  • ps
  • pslatin1

Best Answer

The usual character encoding in Linux is UTF-8; however, enscript does not support UTF-8. You need to convert the text to an encoding supported by enscript, such as ISO 8859-1:

echo "élisée" | iconv -f utf-8 -t iso-8859-1 | enscript -X 88591 -o - | ps2pdf - output.pdf

Or you could use a text-to-PostScript converter which accepts UTF-8 encoded text, such as paps.

Related Question