[poppler] Branch 'poppler-0.6' - glib/poppler-document.cc
Carlos Garcia Campos
carlosgc at kemper.freedesktop.org
Sat Nov 24 09:17:37 PST 2007
glib/poppler-document.cc | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
New commits:
commit 54e89a3f0979b9aece428303c7d9c6feb51fd060
Author: Carlos Garcia Campos <carlosgc at gnome.org>
Date: Sat Nov 24 18:12:00 2007 +0100
Convert passwords from utf-8 to latin-1 when needed. Fixes bug #4557
diff --git a/glib/poppler-document.cc b/glib/poppler-document.cc
index c4179bb..ca74e45 100644
--- a/glib/poppler-document.cc
+++ b/glib/poppler-document.cc
@@ -137,8 +137,20 @@ poppler_document_new_from_file (const char *uri,
g_free (filename);
password_g = NULL;
- if (password != NULL)
- password_g = new GooString (password);
+ if (password != NULL) {
+ if (g_utf8_validate (password, -1, NULL)) {
+ gchar *password_latin;
+
+ password_latin = g_convert (password, -1,
+ "ISO-8859-1",
+ "UTF-8",
+ NULL, NULL, NULL);
+ password_g = new GooString (password_latin);
+ g_free (password_latin);
+ } else {
+ password_g = new GooString (password);
+ }
+ }
newDoc = new PDFDoc(filename_g, password_g, password_g);
if (password_g)
More information about the poppler
mailing list