diff options
-rw-r--r-- | ChangeLog | 3 | ||||
-rw-r--r-- | FAQ | 19 | ||||
-rw-r--r-- | FAQ.fr | 19 | ||||
-rw-r--r-- | src/common/weeconfig.c | 5 | ||||
-rw-r--r-- | src/common/weeconfig.h | 1 | ||||
-rw-r--r-- | src/gui/curses/gui-display.c | 51 | ||||
-rw-r--r-- | src/gui/curses/gui-input.c | 20 | ||||
-rw-r--r-- | src/gui/gui-common.c | 3 | ||||
-rw-r--r-- | src/irc/irc-server.c | 5 | ||||
-rw-r--r-- | weechat/ChangeLog | 3 | ||||
-rw-r--r-- | weechat/FAQ | 19 | ||||
-rw-r--r-- | weechat/FAQ.fr | 19 | ||||
-rw-r--r-- | weechat/src/common/weeconfig.c | 5 | ||||
-rw-r--r-- | weechat/src/common/weeconfig.h | 1 | ||||
-rw-r--r-- | weechat/src/gui/curses/gui-display.c | 51 | ||||
-rw-r--r-- | weechat/src/gui/curses/gui-input.c | 20 | ||||
-rw-r--r-- | weechat/src/gui/gui-common.c | 3 | ||||
-rw-r--r-- | weechat/src/irc/irc-server.c | 5 |
18 files changed, 208 insertions, 44 deletions
@@ -18,7 +18,8 @@ Version 0.1.0 (under dev!): * new [irc] section in config file, option "look_display_away" moved to "irc_display_away" * server messages & errors are all prefixed (by 3 chars, like '-@-') - * added new options for charset: look_charset_decode and look_charset_encode + * added new options for charset (UTF-8 support): look_charset_decode, + look_charset_encode and look_charset_internal * fixed many memory leaks * fixed colors bug: removed "gray" color (replaced by "default"), colors are ok when terminal has white (or light) background @@ -1,4 +1,4 @@ -WeeChat FAQ, 2005-01-16 +WeeChat FAQ, 2005-02-06 ======================= Intended audience: @@ -65,12 +65,23 @@ A: For help you can type /help. For help about a command, type /help command. 2.3 ================================================================================ +Q: I don't see come chars with accents, what can I do? + +A: You have to setup charset used for decoding, encoding, and internal WeeChat + charset. + Change value of option "look_charset_decode" to "UTF-8". + Option "look_charset_internal" should not be changed (default is + "ISO-8859-1"). + + +2.4 +================================================================================ Q: How can I customize key bindings? A: Today you can't do that. This is planed for a future version. -2.4 +2.5 ================================================================================ Q: How can I load Perl scripts? Are Perl scripts compatible with X-chat or/and Irssi ? @@ -83,14 +94,14 @@ A: You can use /perl command to load scripts sorry ;) -2.5 +2.6 ================================================================================ Q: How can I load Python scripts? A: Today Python interface is not developed, so you can't load any Python script. -2.6 +2.7 ================================================================================ Q: How can I load Ruby scripts? @@ -1,4 +1,4 @@ -WeeChat FAQ, 2005-01-16 +WeeChat FAQ, 2005-02-06 ======================= Public concerné : @@ -70,13 +70,24 @@ R: Pour obtenir de l'aide tapez /help. Pour de l'aide sur une commande, 2.3 ================================================================================ +Q: Je ne vois pas bien certains accents dans WeeChat, que faire ? + +R: Il faut configurer le charset utilisé pour le décodage, l'encodage ainsi que + le charset interne à WeeChat. + Modifiez la valeur de l'option "look_charset_decode" en "UTF-8". + L'option "look_charset_internal" ne devrait pas être modifiée (par défaut + "ISO-8859-1"). + + +2.4 +================================================================================ Q: Comment puis-je configurer les raccourcis clavier ? R: Aujourd'hui vous ne pouvez pas le faire. Ce sera possible dans une version future. -2.4 +2.5 ================================================================================ Q: Comment puis-je charger des scripts Perl ? Les scripts Perl sont-ils compatibles avec X-chat et/ou Irssi ? @@ -89,7 +100,7 @@ R: La commande /perl permet de charger les scripts Perl désolé ;) -2.5 +2.6 ================================================================================ Q: Comment puis-je charger les scripts Python ? @@ -97,7 +108,7 @@ R: Aujourd'hui l'interface Python n'est pas déceloppée. Vous ne pouvez donc charger aucun script Python. -2.6 +2.7 ================================================================================ Q: Comment puis-je charger des scripts Ruby ? diff --git a/src/common/weeconfig.c b/src/common/weeconfig.c index f1722e050..cb7b2bc1e 100644 --- a/src/common/weeconfig.c +++ b/src/common/weeconfig.c @@ -64,6 +64,7 @@ int cfg_look_startup_version; char *cfg_look_weechat_slogan; char *cfg_look_charset_decode; char *cfg_look_charset_encode; +char *cfg_look_charset_internal; int cfg_look_color_nicks; int cfg_look_color_actions; int cfg_look_remove_colors_from_msgs; @@ -106,6 +107,10 @@ t_config_option weechat_options_look[] = N_("charset for encoding messages sent to server, examples: UFT-8, ISO-8859-1 (if empty, local charset is used)"), OPTION_TYPE_STRING, 0, 0, 0, "", NULL, NULL, &cfg_look_charset_encode, config_change_buffer_content }, + { "look_charset_internal", N_("internal WeeChat charset (should be ISO)"), + N_("internal WeeChat charset, should be ISO-xxxx even if locale is UTF-8 (if empty, local charset is used)"), + OPTION_TYPE_STRING, 0, 0, 0, + "ISO-8859-1", NULL, NULL, &cfg_look_charset_internal, config_change_buffer_content }, { "look_color_nicks", N_("display nick names with different colors"), N_("display nick names with different colors"), OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_TRUE, diff --git a/src/common/weeconfig.h b/src/common/weeconfig.h index bc90ace0f..b231be902 100644 --- a/src/common/weeconfig.h +++ b/src/common/weeconfig.h @@ -82,6 +82,7 @@ extern int cfg_look_startup_version; extern char *cfg_look_weechat_slogan; extern char *cfg_look_charset_decode; extern char *cfg_look_charset_encode; +extern char *cfg_look_charset_internal; extern int cfg_look_color_nicks; extern int cfg_look_color_actions; extern int cfg_look_remove_colors_from_msgs; diff --git a/src/gui/curses/gui-display.c b/src/gui/curses/gui-display.c index 533f38c69..3b656d532 100644 --- a/src/gui/curses/gui-display.c +++ b/src/gui/curses/gui-display.c @@ -354,7 +354,8 @@ gui_draw_buffer_title (t_gui_buffer *buffer, int erase) if (CHANNEL(buffer)->topic) { buf = weechat_convert_encoding (cfg_look_charset_decode, - local_charset, + (cfg_look_charset_internal && cfg_look_charset_internal[0]) ? + cfg_look_charset_internal : local_charset, CHANNEL(buffer)->topic); mvwprintw (ptr_win->win_title, 0, 0, format, buf); free (buf); @@ -915,7 +916,7 @@ gui_draw_buffer_status (t_gui_buffer *buffer, int erase) { t_gui_window *ptr_win; t_weechat_hotlist *ptr_hotlist; - char format_more[32]; + char format_more[32], *string; int i, first_mode; /* make gcc happy */ @@ -957,7 +958,14 @@ gui_draw_buffer_status (t_gui_buffer *buffer, int erase) COLOR_WIN_STATUS); wprintw (ptr_win->win_status, "%s", SERVER(ptr_win->buffer)->name); if (SERVER(ptr_win->buffer)->is_away) - wprintw (ptr_win->win_status, _("(away)")); + { + string = weechat_convert_encoding (cfg_look_charset_decode, + (cfg_look_charset_internal && cfg_look_charset_internal[0]) ? + cfg_look_charset_internal : local_charset, + _("(away)")); + wprintw (ptr_win->win_status, string); + free (string); + } gui_window_set_color (ptr_win->win_status, COLOR_WIN_STATUS_DELIMITERS); wprintw (ptr_win->win_status, "] "); @@ -1035,8 +1043,15 @@ gui_draw_buffer_status (t_gui_buffer *buffer, int erase) wprintw (ptr_win->win_status, "%d:<DCC> ", ptr_win->buffer->number); else - wprintw (ptr_win->win_status, _("%d:[not connected] "), + { + string = weechat_convert_encoding (cfg_look_charset_decode, + (cfg_look_charset_internal && cfg_look_charset_internal[0]) ? + cfg_look_charset_internal : local_charset, + _("%d:[not connected] ")); + wprintw (ptr_win->win_status, string, ptr_win->buffer->number); + free (string); + } } /* display list of other active windows (if any) with numbers */ @@ -1046,7 +1061,12 @@ gui_draw_buffer_status (t_gui_buffer *buffer, int erase) COLOR_WIN_STATUS_DELIMITERS); wprintw (ptr_win->win_status, "["); gui_window_set_color (ptr_win->win_status, COLOR_WIN_STATUS); - wprintw (ptr_win->win_status, _("Act: ")); + string = weechat_convert_encoding (cfg_look_charset_decode, + (cfg_look_charset_internal && cfg_look_charset_internal[0]) ? + cfg_look_charset_internal : local_charset, + _("Act: ")); + wprintw (ptr_win->win_status, string); + free (string); for (ptr_hotlist = hotlist; ptr_hotlist; ptr_hotlist = ptr_hotlist->next_hotlist) { @@ -1090,8 +1110,13 @@ gui_draw_buffer_status (t_gui_buffer *buffer, int erase) COLOR_WIN_STATUS_DELIMITERS); wprintw (ptr_win->win_status, "["); gui_window_set_color (ptr_win->win_status, COLOR_WIN_STATUS); - wprintw (ptr_win->win_status, _("Lag: %.1f"), + string = weechat_convert_encoding (cfg_look_charset_decode, + (cfg_look_charset_internal && cfg_look_charset_internal[0]) ? + cfg_look_charset_internal : local_charset, + _("Lag: %.1f")); + wprintw (ptr_win->win_status, string, ((float)(SERVER(ptr_win->buffer)->lag)) / 1000); + free (string); gui_window_set_color (ptr_win->win_status, COLOR_WIN_STATUS_DELIMITERS); wprintw (ptr_win->win_status, "]"); @@ -1100,15 +1125,20 @@ gui_draw_buffer_status (t_gui_buffer *buffer, int erase) /* display "-MORE-" if last line is not displayed */ gui_window_set_color (ptr_win->win_status, COLOR_WIN_STATUS_MORE); + string = weechat_convert_encoding (cfg_look_charset_decode, + (cfg_look_charset_internal && cfg_look_charset_internal[0]) ? + cfg_look_charset_internal : local_charset, + _("-MORE-")); if (ptr_win->sub_lines > 0) mvwprintw (ptr_win->win_status, 0, ptr_win->win_width - 7, - _("-MORE-")); + "%s", string); else { - snprintf (format_more, 32, "%%-%ds", strlen (_("-MORE-"))); + snprintf (format_more, 32, "%%-%ds", strlen (string)); mvwprintw (ptr_win->win_status, 0, ptr_win->win_width - 7, format_more, " "); } + free (string); wrefresh (ptr_win->win_status); refresh (); @@ -2289,7 +2319,10 @@ gui_printf_color_type (t_gui_buffer *buffer, int type, int color, char *message, else buf2 = strdup (buf); - buf3 = weechat_convert_encoding (cfg_look_charset_decode, local_charset, buf2); + buf3 = weechat_convert_encoding (cfg_look_charset_decode, + (cfg_look_charset_internal && cfg_look_charset_internal[0]) ? + cfg_look_charset_internal : local_charset, + buf2); if (gui_init_ok) { diff --git a/src/gui/curses/gui-input.c b/src/gui/curses/gui-input.c index ad43813db..ab300f047 100644 --- a/src/gui/curses/gui-input.c +++ b/src/gui/curses/gui-input.c @@ -52,7 +52,7 @@ gui_read_keyb () int key, i; t_gui_buffer *ptr_buffer; t_irc_server *ptr_server; - char new_char[2]; + char new_char[3], *decoded_string; t_dcc *dcc_selected; key = getch (); @@ -616,12 +616,28 @@ gui_read_keyb () "[Debug] key pressed = %d, hex = %02X, octal = %o\n", key, key, key);*/ new_char[0] = key; new_char[1] = '\0'; + decoded_string = NULL; + + /* UTF-8 input */ + if (key == 0xC3) + { + if ((key = getch()) != ERR) + { + new_char[1] = key; + new_char[2] = '\0'; + decoded_string = weechat_convert_encoding (local_charset, cfg_look_charset_internal, new_char); + } + } + gui_buffer_insert_string (gui_current_window->buffer, - new_char, + (decoded_string) ? decoded_string : new_char, gui_current_window->buffer->input_buffer_pos); gui_current_window->buffer->input_buffer_pos++; gui_draw_buffer_input (gui_current_window->buffer, 0); gui_current_window->buffer->completion.position = -1; + + if (decoded_string) + free (decoded_string); } break; } diff --git a/src/gui/gui-common.c b/src/gui/gui-common.c index 88722b0c8..1f34dae7d 100644 --- a/src/gui/gui-common.c +++ b/src/gui/gui-common.c @@ -306,7 +306,8 @@ gui_infobar_printf (int time_displayed, int color, char *message, ...) va_end (argptr); buf2 = weechat_convert_encoding (cfg_look_charset_decode, - local_charset, + (cfg_look_charset_internal && cfg_look_charset_internal[0]) ? + cfg_look_charset_internal : local_charset, buffer); ptr_infobar = (t_gui_infobar *)malloc (sizeof (t_gui_infobar)); diff --git a/src/irc/irc-server.c b/src/irc/irc-server.c index e1d9bff15..781ce79a7 100644 --- a/src/irc/irc-server.c +++ b/src/irc/irc-server.c @@ -395,7 +395,10 @@ server_sendf (t_irc_server * server, char *fmt, ...) gui_printf (server->buffer, "[DEBUG] Sending to server >>> %s\n", buffer); buffer[size_buf - 2] = '\r'; #endif - buf2 = weechat_convert_encoding (local_charset, cfg_look_charset_encode, buffer); + buf2 = weechat_convert_encoding ((cfg_look_charset_internal && cfg_look_charset_internal[0]) ? + cfg_look_charset_internal : local_charset, + cfg_look_charset_encode, + buffer); if (server_send (server, buf2, strlen (buf2)) <= 0) { irc_display_prefix (server->buffer, PREFIX_ERROR); diff --git a/weechat/ChangeLog b/weechat/ChangeLog index 188c10111..0765fb7e0 100644 --- a/weechat/ChangeLog +++ b/weechat/ChangeLog @@ -18,7 +18,8 @@ Version 0.1.0 (under dev!): * new [irc] section in config file, option "look_display_away" moved to "irc_display_away" * server messages & errors are all prefixed (by 3 chars, like '-@-') - * added new options for charset: look_charset_decode and look_charset_encode + * added new options for charset (UTF-8 support): look_charset_decode, + look_charset_encode and look_charset_internal * fixed many memory leaks * fixed colors bug: removed "gray" color (replaced by "default"), colors are ok when terminal has white (or light) background diff --git a/weechat/FAQ b/weechat/FAQ index efa7e33bd..e042ae504 100644 --- a/weechat/FAQ +++ b/weechat/FAQ @@ -1,4 +1,4 @@ -WeeChat FAQ, 2005-01-16 +WeeChat FAQ, 2005-02-06 ======================= Intended audience: @@ -65,12 +65,23 @@ A: For help you can type /help. For help about a command, type /help command. 2.3 ================================================================================ +Q: I don't see come chars with accents, what can I do? + +A: You have to setup charset used for decoding, encoding, and internal WeeChat + charset. + Change value of option "look_charset_decode" to "UTF-8". + Option "look_charset_internal" should not be changed (default is + "ISO-8859-1"). + + +2.4 +================================================================================ Q: How can I customize key bindings? A: Today you can't do that. This is planed for a future version. -2.4 +2.5 ================================================================================ Q: How can I load Perl scripts? Are Perl scripts compatible with X-chat or/and Irssi ? @@ -83,14 +94,14 @@ A: You can use /perl command to load scripts sorry ;) -2.5 +2.6 ================================================================================ Q: How can I load Python scripts? A: Today Python interface is not developed, so you can't load any Python script. -2.6 +2.7 ================================================================================ Q: How can I load Ruby scripts? diff --git a/weechat/FAQ.fr b/weechat/FAQ.fr index b3f4bdde7..fee8e5f2e 100644 --- a/weechat/FAQ.fr +++ b/weechat/FAQ.fr @@ -1,4 +1,4 @@ -WeeChat FAQ, 2005-01-16 +WeeChat FAQ, 2005-02-06 ======================= Public concerné : @@ -70,13 +70,24 @@ R: Pour obtenir de l'aide tapez /help. Pour de l'aide sur une commande, 2.3 ================================================================================ +Q: Je ne vois pas bien certains accents dans WeeChat, que faire ? + +R: Il faut configurer le charset utilisé pour le décodage, l'encodage ainsi que + le charset interne à WeeChat. + Modifiez la valeur de l'option "look_charset_decode" en "UTF-8". + L'option "look_charset_internal" ne devrait pas être modifiée (par défaut + "ISO-8859-1"). + + +2.4 +================================================================================ Q: Comment puis-je configurer les raccourcis clavier ? R: Aujourd'hui vous ne pouvez pas le faire. Ce sera possible dans une version future. -2.4 +2.5 ================================================================================ Q: Comment puis-je charger des scripts Perl ? Les scripts Perl sont-ils compatibles avec X-chat et/ou Irssi ? @@ -89,7 +100,7 @@ R: La commande /perl permet de charger les scripts Perl désolé ;) -2.5 +2.6 ================================================================================ Q: Comment puis-je charger les scripts Python ? @@ -97,7 +108,7 @@ R: Aujourd'hui l'interface Python n'est pas déceloppée. Vous ne pouvez donc charger aucun script Python. -2.6 +2.7 ================================================================================ Q: Comment puis-je charger des scripts Ruby ? diff --git a/weechat/src/common/weeconfig.c b/weechat/src/common/weeconfig.c index f1722e050..cb7b2bc1e 100644 --- a/weechat/src/common/weeconfig.c +++ b/weechat/src/common/weeconfig.c @@ -64,6 +64,7 @@ int cfg_look_startup_version; char *cfg_look_weechat_slogan; char *cfg_look_charset_decode; char *cfg_look_charset_encode; +char *cfg_look_charset_internal; int cfg_look_color_nicks; int cfg_look_color_actions; int cfg_look_remove_colors_from_msgs; @@ -106,6 +107,10 @@ t_config_option weechat_options_look[] = N_("charset for encoding messages sent to server, examples: UFT-8, ISO-8859-1 (if empty, local charset is used)"), OPTION_TYPE_STRING, 0, 0, 0, "", NULL, NULL, &cfg_look_charset_encode, config_change_buffer_content }, + { "look_charset_internal", N_("internal WeeChat charset (should be ISO)"), + N_("internal WeeChat charset, should be ISO-xxxx even if locale is UTF-8 (if empty, local charset is used)"), + OPTION_TYPE_STRING, 0, 0, 0, + "ISO-8859-1", NULL, NULL, &cfg_look_charset_internal, config_change_buffer_content }, { "look_color_nicks", N_("display nick names with different colors"), N_("display nick names with different colors"), OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_TRUE, diff --git a/weechat/src/common/weeconfig.h b/weechat/src/common/weeconfig.h index bc90ace0f..b231be902 100644 --- a/weechat/src/common/weeconfig.h +++ b/weechat/src/common/weeconfig.h @@ -82,6 +82,7 @@ extern int cfg_look_startup_version; extern char *cfg_look_weechat_slogan; extern char *cfg_look_charset_decode; extern char *cfg_look_charset_encode; +extern char *cfg_look_charset_internal; extern int cfg_look_color_nicks; extern int cfg_look_color_actions; extern int cfg_look_remove_colors_from_msgs; diff --git a/weechat/src/gui/curses/gui-display.c b/weechat/src/gui/curses/gui-display.c index 533f38c69..3b656d532 100644 --- a/weechat/src/gui/curses/gui-display.c +++ b/weechat/src/gui/curses/gui-display.c @@ -354,7 +354,8 @@ gui_draw_buffer_title (t_gui_buffer *buffer, int erase) if (CHANNEL(buffer)->topic) { buf = weechat_convert_encoding (cfg_look_charset_decode, - local_charset, + (cfg_look_charset_internal && cfg_look_charset_internal[0]) ? + cfg_look_charset_internal : local_charset, CHANNEL(buffer)->topic); mvwprintw (ptr_win->win_title, 0, 0, format, buf); free (buf); @@ -915,7 +916,7 @@ gui_draw_buffer_status (t_gui_buffer *buffer, int erase) { t_gui_window *ptr_win; t_weechat_hotlist *ptr_hotlist; - char format_more[32]; + char format_more[32], *string; int i, first_mode; /* make gcc happy */ @@ -957,7 +958,14 @@ gui_draw_buffer_status (t_gui_buffer *buffer, int erase) COLOR_WIN_STATUS); wprintw (ptr_win->win_status, "%s", SERVER(ptr_win->buffer)->name); if (SERVER(ptr_win->buffer)->is_away) - wprintw (ptr_win->win_status, _("(away)")); + { + string = weechat_convert_encoding (cfg_look_charset_decode, + (cfg_look_charset_internal && cfg_look_charset_internal[0]) ? + cfg_look_charset_internal : local_charset, + _("(away)")); + wprintw (ptr_win->win_status, string); + free (string); + } gui_window_set_color (ptr_win->win_status, COLOR_WIN_STATUS_DELIMITERS); wprintw (ptr_win->win_status, "] "); @@ -1035,8 +1043,15 @@ gui_draw_buffer_status (t_gui_buffer *buffer, int erase) wprintw (ptr_win->win_status, "%d:<DCC> ", ptr_win->buffer->number); else - wprintw (ptr_win->win_status, _("%d:[not connected] "), + { + string = weechat_convert_encoding (cfg_look_charset_decode, + (cfg_look_charset_internal && cfg_look_charset_internal[0]) ? + cfg_look_charset_internal : local_charset, + _("%d:[not connected] ")); + wprintw (ptr_win->win_status, string, ptr_win->buffer->number); + free (string); + } } /* display list of other active windows (if any) with numbers */ @@ -1046,7 +1061,12 @@ gui_draw_buffer_status (t_gui_buffer *buffer, int erase) COLOR_WIN_STATUS_DELIMITERS); wprintw (ptr_win->win_status, "["); gui_window_set_color (ptr_win->win_status, COLOR_WIN_STATUS); - wprintw (ptr_win->win_status, _("Act: ")); + string = weechat_convert_encoding (cfg_look_charset_decode, + (cfg_look_charset_internal && cfg_look_charset_internal[0]) ? + cfg_look_charset_internal : local_charset, + _("Act: ")); + wprintw (ptr_win->win_status, string); + free (string); for (ptr_hotlist = hotlist; ptr_hotlist; ptr_hotlist = ptr_hotlist->next_hotlist) { @@ -1090,8 +1110,13 @@ gui_draw_buffer_status (t_gui_buffer *buffer, int erase) COLOR_WIN_STATUS_DELIMITERS); wprintw (ptr_win->win_status, "["); gui_window_set_color (ptr_win->win_status, COLOR_WIN_STATUS); - wprintw (ptr_win->win_status, _("Lag: %.1f"), + string = weechat_convert_encoding (cfg_look_charset_decode, + (cfg_look_charset_internal && cfg_look_charset_internal[0]) ? + cfg_look_charset_internal : local_charset, + _("Lag: %.1f")); + wprintw (ptr_win->win_status, string, ((float)(SERVER(ptr_win->buffer)->lag)) / 1000); + free (string); gui_window_set_color (ptr_win->win_status, COLOR_WIN_STATUS_DELIMITERS); wprintw (ptr_win->win_status, "]"); @@ -1100,15 +1125,20 @@ gui_draw_buffer_status (t_gui_buffer *buffer, int erase) /* display "-MORE-" if last line is not displayed */ gui_window_set_color (ptr_win->win_status, COLOR_WIN_STATUS_MORE); + string = weechat_convert_encoding (cfg_look_charset_decode, + (cfg_look_charset_internal && cfg_look_charset_internal[0]) ? + cfg_look_charset_internal : local_charset, + _("-MORE-")); if (ptr_win->sub_lines > 0) mvwprintw (ptr_win->win_status, 0, ptr_win->win_width - 7, - _("-MORE-")); + "%s", string); else { - snprintf (format_more, 32, "%%-%ds", strlen (_("-MORE-"))); + snprintf (format_more, 32, "%%-%ds", strlen (string)); mvwprintw (ptr_win->win_status, 0, ptr_win->win_width - 7, format_more, " "); } + free (string); wrefresh (ptr_win->win_status); refresh (); @@ -2289,7 +2319,10 @@ gui_printf_color_type (t_gui_buffer *buffer, int type, int color, char *message, else buf2 = strdup (buf); - buf3 = weechat_convert_encoding (cfg_look_charset_decode, local_charset, buf2); + buf3 = weechat_convert_encoding (cfg_look_charset_decode, + (cfg_look_charset_internal && cfg_look_charset_internal[0]) ? + cfg_look_charset_internal : local_charset, + buf2); if (gui_init_ok) { diff --git a/weechat/src/gui/curses/gui-input.c b/weechat/src/gui/curses/gui-input.c index ad43813db..ab300f047 100644 --- a/weechat/src/gui/curses/gui-input.c +++ b/weechat/src/gui/curses/gui-input.c @@ -52,7 +52,7 @@ gui_read_keyb () int key, i; t_gui_buffer *ptr_buffer; t_irc_server *ptr_server; - char new_char[2]; + char new_char[3], *decoded_string; t_dcc *dcc_selected; key = getch (); @@ -616,12 +616,28 @@ gui_read_keyb () "[Debug] key pressed = %d, hex = %02X, octal = %o\n", key, key, key);*/ new_char[0] = key; new_char[1] = '\0'; + decoded_string = NULL; + + /* UTF-8 input */ + if (key == 0xC3) + { + if ((key = getch()) != ERR) + { + new_char[1] = key; + new_char[2] = '\0'; + decoded_string = weechat_convert_encoding (local_charset, cfg_look_charset_internal, new_char); + } + } + gui_buffer_insert_string (gui_current_window->buffer, - new_char, + (decoded_string) ? decoded_string : new_char, gui_current_window->buffer->input_buffer_pos); gui_current_window->buffer->input_buffer_pos++; gui_draw_buffer_input (gui_current_window->buffer, 0); gui_current_window->buffer->completion.position = -1; + + if (decoded_string) + free (decoded_string); } break; } diff --git a/weechat/src/gui/gui-common.c b/weechat/src/gui/gui-common.c index 88722b0c8..1f34dae7d 100644 --- a/weechat/src/gui/gui-common.c +++ b/weechat/src/gui/gui-common.c @@ -306,7 +306,8 @@ gui_infobar_printf (int time_displayed, int color, char *message, ...) va_end (argptr); buf2 = weechat_convert_encoding (cfg_look_charset_decode, - local_charset, + (cfg_look_charset_internal && cfg_look_charset_internal[0]) ? + cfg_look_charset_internal : local_charset, buffer); ptr_infobar = (t_gui_infobar *)malloc (sizeof (t_gui_infobar)); diff --git a/weechat/src/irc/irc-server.c b/weechat/src/irc/irc-server.c index e1d9bff15..781ce79a7 100644 --- a/weechat/src/irc/irc-server.c +++ b/weechat/src/irc/irc-server.c @@ -395,7 +395,10 @@ server_sendf (t_irc_server * server, char *fmt, ...) gui_printf (server->buffer, "[DEBUG] Sending to server >>> %s\n", buffer); buffer[size_buf - 2] = '\r'; #endif - buf2 = weechat_convert_encoding (local_charset, cfg_look_charset_encode, buffer); + buf2 = weechat_convert_encoding ((cfg_look_charset_internal && cfg_look_charset_internal[0]) ? + cfg_look_charset_internal : local_charset, + cfg_look_charset_encode, + buffer); if (server_send (server, buf2, strlen (buf2)) <= 0) { irc_display_prefix (server->buffer, PREFIX_ERROR); |