pdf* utilities cannot open files with non-ASCII characters in file path on Windows
Submitted by aur..@..il.com
Assigned to poppler-bugs
Description
Created attachment 74453 PDF test files
pdfinfo and pdftotext (have not tested others) cannot open PDF files with UTF-8 characters in file path.
Environment:
Windows 7 Pro (x64)
poppler.0.22.0_win32: I've been having trouble compiling poppler myself, so I got poppler.0.22.0_win32 binaries from http://blog.alivate.com.au/poppler-windows/ (perhaps this is not a problem with official binaries, which I could not find)
Steps to reproduce:
- Download PDF test files (or create PDF file with UTF-8 character in the name, e.g. testα)
- Open command prompt and navigate to the directory with PDF file
- Run
chcp 65001
to activate UTF-8 codepage - Run
pdfinfo.exe testα.pdf
Outcome:
I/O Error: Couldn't open file 'testa.pdf': No such file or directory.
Note that "testα.pdf" is converted to "testa.pdf"
Using the command line to open that same file with Adobe Acrobat Reader 11.0 worked just fine, so the characters are being correctly passed from the commandline to the program.
Here's a summary of my tests
poppler.0.22.0_win32\bin\pdfinfo.exe test.pdf Tagged: no Form: none Pages: 1 Encrypted: no Page size: 612 x 792 pts (letter) Page rot: 0 File size: 14622 bytes Optimized: no PDF version: 1.4
poppler.0.22.0_win32\bin\pdfinfo.exe testα.pdf I/O Error: Couldn't open file 'testa.pdf': No such file or directory.
poppler.0.22.0_win32\bin\pdftotext.exe test.pdf
poppler.0.22.0_win32\bin\pdftotext.exe testα.pdf I/O Error: Couldn't open file 'testa.pdf': No such file or directory.
Looking at poppler's code, it looks like a win32 version of PDFDoc constructor is defined in PDFDoc.cc
#ifdef _WIN32
PDFDoc::PDFDoc(wchar_t *fileNameA, int fileNameLen, GooString *ownerPassword,
GooString *userPassword, void *guiDataA) {
but LocalPDFDocBuilder.cc calls the general PDFDoc constructor no matter what (by always passing a GooString* instead of wchar_t*). Can't test this though, since I'm having trouble compiling poppler.
Attachment 74453, "PDF test files":
test.tar.bz2