[gimp] plug-ins: fix #2655 Can't open EPS-files with german Umlauts



commit 4f86d8088dd71edf3d99d8ddcb45c2d399da6903
Author: Jacob Boerema <jgboerema gmail com>
Date:   Sat Aug 7 17:22:27 2021 -0400

    plug-ins: fix #2655 Can't open EPS-files with german Umlauts
    
    Due to differences between Windows and most other platforms Ghostscript
    didn't correctly load files with special characters on Windows.
    
    First we needed to make sure that the filenames we use are in utf-8
    format and then tell gsapi that we use utf8 encoding.

 plug-ins/common/file-ps.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)
---
diff --git a/plug-ins/common/file-ps.c b/plug-ins/common/file-ps.c
index 0b0a20c809..a5657c42f9 100644
--- a/plug-ins/common/file-ps.c
+++ b/plug-ins/common/file-ps.c
@@ -1138,9 +1138,8 @@ load_image (GFile   *file,
                              gimp_file_get_utf8_name (file));
 
   /* Try to see if PostScript file is available */
-  filename = g_file_get_path (file);
+  filename = gimp_file_get_utf8_name (file);
   ifp = g_fopen (filename, "r");
-  g_free (filename);
 
   if (! ifp)
     {
@@ -1730,7 +1729,7 @@ ps_open (GFile            *file,
   /* Check if it is a EPS-file */
   *is_epsf = FALSE;
 
-  filename = g_file_get_path (file);
+  filename = gimp_file_get_utf8_name (file);
 
   eps_file = g_fopen (filename, "rb");
 
@@ -1870,8 +1869,6 @@ ps_open (GFile            *file,
   g_ptr_array_add (cmdA, g_strdup ("-f"));
   g_ptr_array_add (cmdA, g_strdup (filename));
 
-  g_free (filename);
-
   if (*is_epsf)
     {
       g_ptr_array_add (cmdA, g_strdup ("-c"));
@@ -1899,6 +1896,7 @@ ps_open (GFile            *file,
 
   code = gsapi_new_instance (&instance, NULL);
   if (code == 0) {
+    code = gsapi_set_arg_encoding(instance, GS_ARG_ENCODING_UTF8);
     code = gsapi_init_with_args (instance, cmdA->len - 1, pcmdA);
     code = gsapi_exit (instance);
     gsapi_delete_instance (instance);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]