diff options
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | src/text.c | 11 |
2 files changed, 13 insertions, 3 deletions
@@ -1,5 +1,10 @@ 2007-05-27 Lucas Rocha <lucasr@gnome.org> + * src/text.c: correctly handle UTF-8 input text in the text info + dialog (Fixes bug #407275). + +2007-05-27 Lucas Rocha <lucasr@gnome.org> + * src/main.c: initialize GTK+ before parsing command line options to better handle errors on display setting (Fixes bug #410055). @@ -74,9 +74,14 @@ zenity_text_handle_stdin (GIOChannel *channel, gsize utflen; gtk_text_buffer_get_end_iter (buffer, &end); - utftext = g_convert_with_fallback (buf, len, "UTF-8", "ISO-8859-1", NULL, &localelen, &utflen, NULL); - gtk_text_buffer_insert (buffer, &end, utftext, utflen); - g_free (utftext); + + if (!g_utf8_validate (buf, len, NULL)) { + utftext = g_convert_with_fallback (buf, len, "UTF-8", "ISO-8859-1", NULL, &localelen, &utflen, NULL); + gtk_text_buffer_insert (buffer, &end, utftext, utflen); + g_free (utftext); + } else { + gtk_text_buffer_insert (buffer, &end, buf, len); + } } } |