summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLucas Rocha <lucasr@gnome.org>2007-05-27 20:35:32 +0000
committerLucas Almeida Rocha <lucasr@src.gnome.org>2007-05-27 20:35:32 +0000
commit5868adac7501134a8cb9d2ace1ae12622368a910 (patch)
treec2248580c6c17603cb0a09a100378517d9f56e41 /src
parentinitialize GTK+ before parsing command line options to better handle (diff)
downloadzenity-5868adac7501134a8cb9d2ace1ae12622368a910.tar.gz
zenity-5868adac7501134a8cb9d2ace1ae12622368a910.tar.bz2
zenity-5868adac7501134a8cb9d2ace1ae12622368a910.zip
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
Diffstat (limited to 'src')
-rw-r--r--src/text.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/text.c b/src/text.c
index b7816826..a8da744a 100644
--- a/src/text.c
+++ b/src/text.c
@@ -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);
+ }
}
}
bgstack15