Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evince/ChangeLog,v
retrieving revision 1.590
diff -u -u -r1.590 ChangeLog
--- ChangeLog	31 Jul 2005 13:06:36 -0000	1.590
+++ ChangeLog	2 Aug 2005 15:47:16 -0000
@@ -1,3 +1,8 @@
+2005-08-02  Carlos Garcia Campos  <carlosgc@gnome.org>
+
+	* ps/ps-document.c: convert filename to utf8 when there is an error
+	loading document. Fixes #309915
+
 2005-07-31  Christian Persch  <chpe@cvs.gnome.org>
 
 	* shell/ev-window.c: (load_print_config_from_file),
Index: ps/ps-document.c
===================================================================
RCS file: /cvs/gnome/evince/ps/ps-document.c,v
retrieving revision 1.54
diff -u -u -r1.54 ps-document.c
--- ps/ps-document.c	29 Jul 2005 16:02:27 -0000	1.54
+++ ps/ps-document.c	2 Aug 2005 15:47:17 -0000
@@ -459,7 +459,7 @@
 static void
 setup_page (PSDocument *gs, int page, double scale)
 {
-	char buf[1024];
+	gchar *buf;
 	int urx, ury, llx, lly, orientation;
 	char scaled_xdpi[G_ASCII_DTOSTR_BUF_SIZE];	
 	char scaled_ydpi[G_ASCII_DTOSTR_BUF_SIZE];
@@ -471,14 +471,16 @@
 	g_ascii_dtostr (scaled_xdpi, G_ASCII_DTOSTR_BUF_SIZE, get_xdpi (gs) * scale);
 	g_ascii_dtostr (scaled_ydpi, G_ASCII_DTOSTR_BUF_SIZE, get_ydpi (gs) * scale);
 
-	g_snprintf (buf, 1024, "%ld %d %d %d %d %d %s %s %d %d %d %d",
-		    0L, orientation * 90, llx, lly, urx, ury,
-		    scaled_xdpi, scaled_ydpi,		    
-		    0, 0, 0, 0);
+	buf = g_strdup_printf ("%ld %d %d %d %d %d %s %s %d %d %d %d",
+			       0L, orientation * 90, llx, lly, urx, ury,
+			       scaled_xdpi, scaled_ydpi,
+			       0, 0, 0, 0);
 	LOG ("GS property %s", buf);
 
 	gdk_property_change (gs->pstarget, gs_class->gs_atom, gs_class->string_atom,
 			     8, GDK_PROP_MODE_REPLACE, (guchar *)buf, strlen(buf));
+	g_free (buf);
+	
 	gdk_flush ();
 }
 
@@ -902,10 +904,21 @@
 		/* sucessfully uncompressed file */
 		gs->gs_filename_unc = filename_unc;
 	} else {
+		gchar *utf8 = NULL;
+		gchar *msg;
+
 		/* report error */
-		g_snprintf (buf, 1024, _("Error while decompressing file %s:\n"),
-                            gs->gs_filename);
-		interpreter_failed (gs, buf);
+		utf8 = g_locale_to_utf8 (gs->gs_filename, -1, NULL, NULL, NULL);
+		
+		if (utf8) {
+			msg = g_strdup_printf (_("Error while decompressing file %s:\n"), utf8);
+			g_free (utf8);
+		} else {
+			msg = g_strdup (_("Error while decompressing file\n"));
+		}
+		
+		interpreter_failed (gs, msg);
+		g_free (msg);
 		unlink (filename_unc);
 		g_free (filename_unc);
 		filename_unc = NULL;
@@ -957,10 +970,20 @@
 		gchar *filename = NULL;
 
 		if (!file_readable(fname)) {
-			gchar buf[1024];
+			gchar *utf8 = NULL;
+			gchar *msg;
 
-			g_snprintf (buf, 1024, _("Cannot open file %s.\n"), fname);
-			interpreter_failed (gs, buf);
+			utf8 = g_locale_to_utf8 (fname, -1, NULL, NULL, NULL);
+
+			if (utf8) {
+				msg = g_strdup_printf (_("Cannot open file %s.\n"), utf8);
+				g_free (utf8);
+			} else {
+				msg = g_strdup (_("Cannot open file.\n"));
+			}
+			
+			interpreter_failed (gs, msg);
+			g_free (msg);
 			gs->gs_status = _("File is not readable.");
 		} else {
 			filename = check_filecompressed(gs);
@@ -1072,10 +1095,21 @@
 
 	result = document_load (PS_DOCUMENT (document), filename);
 	if (!result) {
-		g_set_error (error, G_FILE_ERROR,
-			     G_FILE_ERROR_FAILED,
-			     "Failed to load document '%s'\n",
-			     uri);
+		gchar *utf8 = NULL;
+
+		utf8 = g_locale_to_utf8 (filename, -1, NULL, NULL, NULL);
+
+		if (utf8) {
+			g_set_error (error, G_FILE_ERROR,
+				     G_FILE_ERROR_FAILED,
+				     _("Failed to load document '%s'"),
+				     utf8);
+			g_free (utf8);
+		} else {
+			g_set_error (error, G_FILE_ERROR,
+				     G_FILE_ERROR_FAILED,
+				     _("Failed to load document"));
+		}
 	}
 
 	g_free (filename);
