summaryrefslogtreecommitdiff
path: root/src/text.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/text.c')
-rw-r--r--src/text.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/text.c b/src/text.c
index b781682..a8da744 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);
+ }
}
}