2006-12-17 [colin] 2.6.1cvs45
[claws.git] / src / gtk / logwindow.c
index 88b89faf2f8b7ceb9dfb2a0f98a9c47b0be9e424..7d4e07c3a65248047b227c58ea8bcd481d861c4a 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2006 Hiroyuki Yamamoto and the Sylpheed-Claws team
+ * Copyright (C) 1999-2006 Hiroyuki Yamamoto and the Claws Mail team
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -291,9 +291,17 @@ static gboolean log_window_append(gpointer source, gpointer data)
        if (head)
                gtk_text_buffer_insert_with_tags_by_name(buffer, &iter, head, -1,
                                                         tag, NULL);
-       gtk_text_buffer_insert_with_tags_by_name(buffer, &iter, logtext->text, -1,
-                                                tag, NULL);
 
+       if (!g_utf8_validate(logtext->text, -1, NULL)) {
+               gchar * mybuf = g_malloc(strlen(logtext->text)*2 +1);
+               conv_localetodisp(mybuf, strlen(logtext->text)*2 +1, logtext->text);
+               gtk_text_buffer_insert_with_tags_by_name(buffer, &iter, mybuf, -1,
+                                                        tag, NULL);
+               g_free(mybuf);
+       } else {
+               gtk_text_buffer_insert_with_tags_by_name(buffer, &iter, logtext->text, -1,
+                                                        tag, NULL);
+       }
        gtk_text_buffer_get_start_iter(buffer, &iter);
 
        if (logwindow->clip)