r15749 - gnucash/trunk/src/backend/file - On Windows, convert filename parameter for xml parser to system codepage.

Andreas Köhler andi5 at cvs.gnucash.org
Fri Mar 23 15:40:32 EDT 2007


Author: andi5
Date: 2007-03-23 15:40:32 -0400 (Fri, 23 Mar 2007)
New Revision: 15749
Trac: http://svn.gnucash.org/trac/changeset/15749

Modified:
   gnucash/trunk/src/backend/file/sixtp.c
Log:
On Windows, convert filename parameter for xml parser to system codepage.


Modified: gnucash/trunk/src/backend/file/sixtp.c
===================================================================
--- gnucash/trunk/src/backend/file/sixtp.c	2007-03-23 19:38:08 UTC (rev 15748)
+++ gnucash/trunk/src/backend/file/sixtp.c	2007-03-23 19:40:32 UTC (rev 15749)
@@ -727,7 +727,21 @@
                  gpointer *parse_result) 
 {
     gboolean ret;
-    xmlParserCtxtPtr context = xmlCreateFileParserCtxt( filename );
+    xmlParserCtxtPtr context;
+
+#ifdef G_OS_WIN32
+    {
+        gchar *conv_name = g_win32_locale_filename_from_utf8(filename);
+        if (!conv_name) {
+            g_warning("Could not convert '%s' to system codepage", filename);
+            return FALSE;
+        }
+        context = xmlCreateFileParserCtxt(conv_name);
+        g_free(conv_name);
+    }
+#else
+    context = xmlCreateFileParserCtxt(filename);
+#endif
     ret = sixtp_parse_file_common(sixtp, context, data_for_top_level,
                                   global_data, parse_result);
     return ret;



More information about the gnucash-changes mailing list