[poppler] poppler/glib: poppler-document.cc,1.20,1.21

Martin Kretzschmar m_kretzschmar at freedesktop.org
Mon Jun 20 11:45:44 PDT 2005


Update of /cvs/poppler/poppler/glib
In directory gabe:/tmp/cvs-serv11133/glib

Modified Files:
	poppler-document.cc 
Log Message:
(info_dict_get_string): convert from PDFDocEncoding to UTF-8.


Index: poppler-document.cc
===================================================================
RCS file: /cvs/poppler/poppler/glib/poppler-document.cc,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- poppler-document.cc	20 Jun 2005 17:38:28 -0000	1.20
+++ poppler-document.cc	20 Jun 2005 18:45:41 -0000	1.21
@@ -27,6 +27,7 @@
 #include <SplashOutputDev.h>
 #include <Stream.h>
 #include <FontInfo.h>
+#include <PDFDocEncoding.h>
 
 #include "poppler.h"
 #include "poppler-private.h"
@@ -219,7 +220,20 @@
 			goo_value->getLength () - 2,
 			"UTF-8", "UTF-16BE", NULL, NULL, NULL);
   } else {
-    result = g_strndup (goo_value->getCString (), goo_value->getLength ());
+    int len;
+    gunichar *ucs4_temp;
+    int i;
+    
+    len = goo_value->getLength ();
+    ucs4_temp = g_new (gunichar, len + 1);
+    for (i = 0; i < len; ++i) {
+      ucs4_temp[i] = pdfDocEncoding[(unsigned char)goo_value->getChar(i)];
+    }
+    ucs4_temp[i] = 0;
+
+    result = g_ucs4_to_utf8 (ucs4_temp, -1, NULL, NULL, NULL);
+
+    g_free (ucs4_temp);
   }
 
   obj.free ();



More information about the poppler mailing list