diff options
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | src/plugins/logger/logger.c | 37 |
2 files changed, 26 insertions, 15 deletions
@@ -1,7 +1,7 @@ WeeChat ChangeLog ================= Sébastien Helleu <flashcode@flashtux.org> -v0.3.8-dev, 2012-05-02 +v0.3.8-dev, 2012-05-03 Version 0.3.8 (under dev!) @@ -55,6 +55,8 @@ Version 0.3.8 (under dev!) * irc: add support of "external" SASL mechanism (task #11864) * irc: close server buffer when server is deleted * irc: add search for lower case nicks in option irc.look.nick_color_force +* logger: fix charset of lines displayed in backlog when terminal charset is + different from UTF-8 (bug #36379) * logger: add colors for backlog lines and end of backlog, new options: logger.color.backlog_line and logger.color.backlog_end (task #11966) * perl: fix compilation on OS X (bug #30701) diff --git a/src/plugins/logger/logger.c b/src/plugins/logger/logger.c index 7c440e813..f5dad66d2 100644 --- a/src/plugins/logger/logger.c +++ b/src/plugins/logger/logger.c @@ -914,12 +914,15 @@ logger_buffer_renamed_signal_cb (void *data, const char *signal, void logger_backlog (struct t_gui_buffer *buffer, const char *filename, int lines) { + const char *charset; struct t_logger_line *last_lines, *ptr_lines; - char *pos_message, *pos_tab, *error; + char *pos_message, *pos_tab, *error, *message; time_t datetime, time_now; struct tm tm_line; int num_lines; + charset = weechat_info_get ("charset_terminal", ""); + weechat_buffer_set (buffer, "print_hooks_enabled", "0"); num_lines = 0; last_lines = logger_tail_file (filename, lines); @@ -949,19 +952,25 @@ logger_backlog (struct t_gui_buffer *buffer, const char *filename, int lines) } pos_message = (pos_message && (datetime != 0)) ? pos_message + 1 : ptr_lines->data; - pos_tab = strchr (pos_message, '\t'); - if (pos_tab) - pos_tab[0] = '\0'; - weechat_printf_date_tags (buffer, datetime, - "no_highlight,notify_none", - "%s%s%s%s%s", - weechat_color (weechat_config_string (logger_config_color_backlog_line)), - pos_message, - (pos_tab) ? "\t" : "", - (pos_tab) ? weechat_color (weechat_config_string (logger_config_color_backlog_line)) : "", - (pos_tab) ? pos_tab + 1 : ""); - if (pos_tab) - pos_tab[0] = '\t'; + message = (charset) ? + weechat_iconv_to_internal (charset, pos_message) : strdup (pos_message); + if (message) + { + pos_tab = strchr (message, '\t'); + if (pos_tab) + pos_tab[0] = '\0'; + weechat_printf_date_tags (buffer, datetime, + "no_highlight,notify_none", + "%s%s%s%s%s", + weechat_color (weechat_config_string (logger_config_color_backlog_line)), + message, + (pos_tab) ? "\t" : "", + (pos_tab) ? weechat_color (weechat_config_string (logger_config_color_backlog_line)) : "", + (pos_tab) ? pos_tab + 1 : ""); + if (pos_tab) + pos_tab[0] = '\t'; + free (message); + } num_lines++; ptr_lines = ptr_lines->next_line; } |