I'm trying to use ps2pdf to convert a Postscript file to PDF, but the Postscript file has a UTF-8 character in it which is not rendered properly.
We have a website with a database, where users can enter their names and do some things and they get a printable PDF certificate. It has worked for years without trouble, until recently when it was used by someone with 'ñ' in their name. (Apparently this has never happened before.)
The database has it in the field fine. There's a Perl script (of unknown age) which gets the data out of the database and assembles a Postscript file, and that looks okay too:
63 688 206 (Peña) 26 tline
I have checked the Postscript; the character 'ñ' is the two-byte UTF-8 encoding 0xc3 and 0xb1.
But when I run that through ps2pdf, the PDF shows the two characters '^-'. Searching online and reading the manuals has given me answers that don't seem to work. Using iconv -f utf8 certificate.ps -t utf16 -o certificate.pdf
seems to have done the right thing, but ps2pdf doesn't seem to like UTF-16 input, because it prints Error: /undefined in ��
.
It feels like there's something obvious that I'm missing, but since I'm missing it I don't know what it is. Is there some way to get ghostscript to handle UTF-8 input?