glib r6680 - in trunk: . glib



Author: murrayc
Date: Tue Mar 11 15:43:25 2008
New Revision: 6680
URL: http://svn.gnome.org/viewvc/glib?rev=6680&view=rev

Log:
2008-03-11  Murray Cumming  <murrayc murrayc com>

Bug 521591 â g_markup_parse_context_parse() creates GError message that 
is invalid UTF8.

* glib/gmarkup.c (set_error): Make sure that the GError::message is 
valid UTF-8 even if it is complaining about invalid UTF-8 in the 
markup text, using _g_utf8_make_valid().


Modified:
   trunk/ChangeLog
   trunk/glib/gmarkup.c

Modified: trunk/glib/gmarkup.c
==============================================================================
--- trunk/glib/gmarkup.c	(original)
+++ trunk/glib/gmarkup.c	Tue Mar 11 15:43:25 2008
@@ -215,14 +215,20 @@
 {
   GError *tmp_error;
   gchar *s;
+  gchar *s_valid;
   va_list args;
 
   va_start (args, format);
   s = g_strdup_vprintf (format, args);
   va_end (args);
 
-  tmp_error = g_error_new_literal (G_MARKUP_ERROR, code, s);
+  /* Make sure that the GError message is valid UTF-8 even if it is 
+   * complaining about invalid UTF-8 in the markup: */
+  s_valid = _g_utf8_make_valid (s);
+  tmp_error = g_error_new_literal (G_MARKUP_ERROR, code, s_valid);
+
   g_free (s);
+  g_free (s_valid);
 
   g_prefix_error (&tmp_error,
                   _("Error on line %d char %d: "),



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