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

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.

  • Using iso-8859-1//TRANSLIT instead of plain iso-8859-1 may save you some iconv: illegal input sequence at position XX errors. – Skippy le Grand Gourou Jun 19 '18 at 14:29

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.