correctly handle UTF-8 input text in the text info dialog (Fixes bug

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).

svn path=/trunk/; revision=1220
This commit is contained in:
Lucas Rocha 2007-05-27 20:35:32 +00:00 committed by Lucas Almeida Rocha
parent b73e72bcfe
commit 5868adac75
2 changed files with 13 additions and 3 deletions

View File

@ -1,3 +1,8 @@
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

View File

@ -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);
}
}
}