After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 544560 - Loading PDF file fails if its path contains non-ascii characters
Loading PDF file fails if its path contains non-ascii characters
Status: RESOLVED FIXED
Product: GIMP
Classification: Other
Component: Plugins
2.4.x
Other Windows
: Normal normal
: 2.8
Assigned To: GIMP Bugs
GIMP Bugs
: 578233 616269 623298 634548 667174 PDF-path-bug 668157 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2008-07-24 15:44 UTC by Michael Schumacher
Modified: 2012-04-27 14:21 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Suggested patch (1.51 KB, patch)
2009-11-11 16:20 UTC, Tor Lillqvist
none Details | Review

Description Michael Schumacher 2008-07-24 15:44:24 UTC
1. Place any PDF file into a directory call e.g. C:\äöü
2. Try to load file

Resulting error:

  poppler.exe Warning
Could not open 'C:\Documents and Settings\msi\My Documents\mämömö\a3 pdf sample - Google Search.pdf' for reading: Failed to load document from data (error 1)'

The same file load without problems from other directories.

The libpoppler files included in the 2.4.6 installer do not include any version information, unfortunately.
Comment 1 Sven Neumann 2008-07-24 19:06:35 UTC
Please file this as a bug report against libpoppler then. The GIMP plug-in just passes it an URI created using g_filename_to_uri().
Comment 2 Michael Schumacher 2008-07-26 22:21:16 UTC
Hm... latest binary available from ftp.gnome.org is 0.64, libpoppler is at 0.8.4. I'll build it myself before reporting anything upstream.
Comment 3 Michael Schumacher 2009-01-21 09:43:10 UTC
... well, libpoppler is still hard to build, it seems.
Comment 4 Tor Lillqvist 2009-01-21 10:08:54 UTC
My poppler-dev-0.6.4.zip contains the build script called make/poppler-0.6.4.sh that contains some sed invokation and patches (inline in the script). Try using them for poppler 0.8.4, too?
Comment 5 Michael Schumacher 2009-04-08 14:22:57 UTC
*** Bug 578233 has been marked as a duplicate of this bug. ***
Comment 6 Michael Natterer 2009-06-07 23:09:59 UTC
Michael, Tor, any news on this one? How is this a gimp bug anyway?
Comment 7 Tor Lillqvist 2009-11-11 14:25:20 UTC
The file is originally in UTF-8 (the "GLib file name encoding" on Windows), and then it is converter to a URI with g_filename_to_uri(), passed to  poppler_document_new_from_file(), which converts it back to a (UTF-8 encoded) filename, which passes it on to PDFDoc::PDFDoc() which just passes it to fopen(). fopen() does not understand UTF-8, it wants system codepage ("ANSI").

There seems to be also a Windows-specific PDFDoc::PDFDOc() that takes a wide-char string. poppler_document_new_from_file() should use that instead on Windows. Somebody feel free to report a bug against pooppler.
Comment 8 Tor Lillqvist 2009-11-11 14:27:33 UTC
Resolving as NOTGNOME, although arguably one could say that GIMP's file-pdf.c should not pass URIs of UTF-8-encoded file names to poppler. But I think in this case that is the right thing to do, as it's specifically poppler's GLib wrapper layer that file-pdf.c is calling, so it should know that file names are in UTF-8 in GLib on Windows.
Comment 9 Tor Lillqvist 2009-11-11 14:32:31 UTC
Nah, the easiest fix would be to just map in the file in file-pdf.c using g_mapped_file_new(), and call poppler_document_new_from_data() instead. No need to wait for poppler maintainers to fix the Windows UTF-8 issue there. Reopening...
Comment 10 Michael Schumacher 2009-11-11 14:40:42 UTC
Filed as https://bugs.freedesktop.org/show_bug.cgi?id=25032 in Freedesktop's Bugzilla.
Comment 11 Tor Lillqvist 2009-11-11 16:20:11 UTC
Created attachment 147485 [details] [review]
Suggested patch

Seems to work and fixes the problem.
Comment 12 Sven Neumann 2009-11-12 21:34:37 UTC
It's a workaround and such workarounds make it even harder to port the file plug-ins to GIO. But for the moment it's probably the best thing to do.
Comment 13 Michael Schumacher 2010-04-20 10:35:13 UTC
*** Bug 616269 has been marked as a duplicate of this bug. ***
Comment 14 Martin Nordholts 2010-05-16 08:59:32 UTC
Seems to work for me too, so let's commit then:

commit df24468fde963d158d57d8926c4459f718403335
Author: Tor Lillqvist <tml@iki.fi>
Date:   Sun May 16 11:00:53 2010 +0200

    Bug 544560 - Loading PDF file fails if its path contains non-ascii characters
    
    Use poppler_document_new_from_data() instead of
    poppler_document_new_from_file() to work around filename encoding
    issues.
Comment 15 Tor Lillqvist 2010-07-01 15:36:37 UTC
Should we cherry-pick that to gimp-2-6, too?
Comment 16 Tor Lillqvist 2010-07-01 15:37:30 UTC
*** Bug 623298 has been marked as a duplicate of this bug. ***
Comment 17 Michael Schumacher 2010-11-10 22:00:54 UTC
*** Bug 634548 has been marked as a duplicate of this bug. ***
Comment 18 Michael Schumacher 2012-01-03 13:48:25 UTC
*** Bug 667174 has been marked as a duplicate of this bug. ***
Comment 19 Michael Schumacher 2012-01-03 15:36:13 UTC
*** Bug 667188 has been marked as a duplicate of this bug. ***
Comment 20 Michael Schumacher 2012-04-27 14:21:51 UTC
*** Bug 668157 has been marked as a duplicate of this bug. ***