charset: do not allow "UTF-8" in charset options (useless because UTF-8 is the internal WeeChat charset)

v2.8-utf8proc
Sebastien Helleu 2012-07-14 10:50:49 +02:00
parent 788f634fbc
commit f4dc85a3cb
13 changed files with 147 additions and 22 deletions

View File

@ -1,7 +1,7 @@
WeeChat ChangeLog
=================
Sébastien Helleu <flashcode@flashtux.org>
v0.3.9-dev, 2012-07-13
v0.3.9-dev, 2012-07-14
Version 0.3.9 (under dev!)
@ -30,6 +30,8 @@ Version 0.3.9 (under dev!)
command /aspell (rename options enable/disable/dictlist to
setdict/deldict/listdict), display aspell status with /aspell (task #11988)
* aspell: add missing dictionaries (ast/grc/hus/kn/ky)
* charset: do not allow "UTF-8" in charset options (useless because UTF-8 is the
internal WeeChat charset)
* guile: fix crash when unloading a script without pointer to interpreter
* guile: fix path of guile include dirs in cmake build (patch #7790)
* irc: add bar item "buffer_modes", remove option irc.look.item_channel_modes

View File

@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.3.9-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2012-07-13 10:55+0200\n"
"POT-Creation-Date: 2012-07-14 10:46+0200\n"
"PO-Revision-Date: 2012-06-03 09:49+0200\n"
"Last-Translator: Jiri Golembiovsky <golemj@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -3755,6 +3755,13 @@ msgstr "%s: upozornění: slovník \"%s\" není dostupný ve vašem systému"
msgid "%s%s: not enough memory to create new speller"
msgstr "%s%s: nedostatek paměti pro vytvoření kontroly pravopisu"
#, c-format
msgid ""
"%s%s: UTF-8 is now allowed in charset options (it is internal and default "
"charset: default encode is UTF-8 and decode of UTF-8 is OK even if you "
"specify another charset to decode)"
msgstr ""
#, c-format
msgid "%s%s: error creating charset \"%s\" => \"%s\""
msgstr "%s%s: chyba vytváření znakové sady \"%s\" => \"%s\""

View File

@ -23,7 +23,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.3.7-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2012-07-13 10:55+0200\n"
"POT-Creation-Date: 2012-07-14 10:46+0200\n"
"PO-Revision-Date: 2012-06-30 14:28+0100\n"
"Last-Translator: Nils Görs <weechatter@arcor.de>\n"
"Language-Team: German <weechatter@arcor.de>\n"
@ -4113,6 +4113,13 @@ msgstr "%s: Hinweis: das Wörterbuch \"%s\" ist auf dem Rechner nicht verfügbar
msgid "%s%s: not enough memory to create new speller"
msgstr "%s%s: Nicht genug Speicher um neue Rechtschreibung zu erstellen"
#, c-format
msgid ""
"%s%s: UTF-8 is now allowed in charset options (it is internal and default "
"charset: default encode is UTF-8 and decode of UTF-8 is OK even if you "
"specify another charset to decode)"
msgstr ""
#, c-format
msgid "%s%s: error creating charset \"%s\" => \"%s\""
msgstr "%s%s: Fehler bei der Erstellung des Zeichensatzes \"%s\" => \"%s\""

View File

@ -22,7 +22,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.3.9-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2012-07-13 10:55+0200\n"
"POT-Creation-Date: 2012-07-14 10:46+0200\n"
"PO-Revision-Date: 2012-06-03 09:49+0200\n"
"Last-Translator: Elián Hanisch <lambdae2@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -3952,6 +3952,13 @@ msgstr "%s: atención: diccionario \"%s\" no está disponible en su sistema"
msgid "%s%s: not enough memory to create new speller"
msgstr "%s%s: no hay suficiente memoria para crear el nuevo deletreador"
#, c-format
msgid ""
"%s%s: UTF-8 is now allowed in charset options (it is internal and default "
"charset: default encode is UTF-8 and decode of UTF-8 is OK even if you "
"specify another charset to decode)"
msgstr ""
#, c-format
msgid "%s%s: error creating charset \"%s\" => \"%s\""
msgstr "%s%s: error al crear el set de caracteres \"%s\" => \"%s\""

View File

@ -21,8 +21,8 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.3.9-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2012-07-13 10:55+0200\n"
"PO-Revision-Date: 2012-07-13 10:57+0200\n"
"POT-Creation-Date: 2012-07-14 10:46+0200\n"
"PO-Revision-Date: 2012-07-14 10:46+0200\n"
"Last-Translator: Sebastien Helleu <flashcode@flashtux.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
"Language: French\n"
@ -3989,6 +3989,16 @@ msgstr ""
msgid "%s%s: not enough memory to create new speller"
msgstr "%s%s: pas assez de mémoire pour créer un nouveau speller"
#, c-format
msgid ""
"%s%s: UTF-8 is now allowed in charset options (it is internal and default "
"charset: default encode is UTF-8 and decode of UTF-8 is OK even if you "
"specify another charset to decode)"
msgstr ""
"%s%s: UTF-8 n'est pas autorisé dans les options de charset (c'est le charset "
"interne et par défaut: l'encodage par défaut est UTF-8 et le décodage "
"d'UTF-8 est OK même si vous spécifiez un autre charset à décoder)"
#, c-format
msgid "%s%s: error creating charset \"%s\" => \"%s\""
msgstr "%s%s: erreur en création du charset \"%s\" => \"%s\""

View File

@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.3.9-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2012-07-13 10:55+0200\n"
"POT-Creation-Date: 2012-07-14 10:46+0200\n"
"PO-Revision-Date: 2012-06-03 09:49+0200\n"
"Last-Translator: Andras Voroskoi <voroskoi@frugalware.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -3384,6 +3384,13 @@ msgstr ""
msgid "%s%s: not enough memory to create new speller"
msgstr "%s nincs elegendő memória új DCC számára\n"
#, c-format
msgid ""
"%s%s: UTF-8 is now allowed in charset options (it is internal and default "
"charset: default encode is UTF-8 and decode of UTF-8 is OK even if you "
"specify another charset to decode)"
msgstr ""
#, fuzzy, c-format
msgid "%s%s: error creating charset \"%s\" => \"%s\""
msgstr "%s nincs elég memória az információs pult üzenethez\n"

View File

@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.3.9-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2012-07-13 10:55+0200\n"
"POT-Creation-Date: 2012-07-14 10:46+0200\n"
"PO-Revision-Date: 2012-06-03 09:49+0200\n"
"Last-Translator: Marco Paolone <marcopaolone@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -3942,6 +3942,13 @@ msgstr ""
msgid "%s%s: not enough memory to create new speller"
msgstr "%s%s: memoria non sufficiente per creare un nuovo controllore"
#, c-format
msgid ""
"%s%s: UTF-8 is now allowed in charset options (it is internal and default "
"charset: default encode is UTF-8 and decode of UTF-8 is OK even if you "
"specify another charset to decode)"
msgstr ""
#, c-format
msgid "%s%s: error creating charset \"%s\" => \"%s\""
msgstr ""

View File

@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.3.9-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2012-07-13 10:55+0200\n"
"POT-Creation-Date: 2012-07-14 10:46+0200\n"
"PO-Revision-Date: 2012-06-03 09:49+0200\n"
"Last-Translator: AYANOKOUZI, Ryuunosuke <i38w7i3@yahoo.co.jp>\n"
"Language-Team: Japanese <https://github.com/l/WeeChat>\n"
@ -3841,6 +3841,13 @@ msgstr "%s: 警告: 辞書 \"%s\" がこのシステム上では利用できま
msgid "%s%s: not enough memory to create new speller"
msgstr "%s%s: 新しい speller を作る十分なメモリがありません"
#, c-format
msgid ""
"%s%s: UTF-8 is now allowed in charset options (it is internal and default "
"charset: default encode is UTF-8 and decode of UTF-8 is OK even if you "
"specify another charset to decode)"
msgstr ""
#, c-format
msgid "%s%s: error creating charset \"%s\" => \"%s\""
msgstr "%s%s: 文字集合 \"%s\" => \"%s\" の作成中にエラー"

View File

@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.3.9-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2012-07-13 10:55+0200\n"
"POT-Creation-Date: 2012-07-14 10:46+0200\n"
"PO-Revision-Date: 2012-06-03 09:49+0200\n"
"Last-Translator: Krzysztof Korościk <soltys@szluug.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -3930,6 +3930,13 @@ msgstr "%s: ostrzeżenie: słownik \"%s\" nie jest dostępny w Twoim systemie"
msgid "%s%s: not enough memory to create new speller"
msgstr "%s%s: za mało pamięci na utworzenie nowego słownika"
#, c-format
msgid ""
"%s%s: UTF-8 is now allowed in charset options (it is internal and default "
"charset: default encode is UTF-8 and decode of UTF-8 is OK even if you "
"specify another charset to decode)"
msgstr ""
#, c-format
msgid "%s%s: error creating charset \"%s\" => \"%s\""
msgstr "%s%s: błąd przy tworzeniu zestawu znaków (kodowania) \"%s\" => \"%s\""

View File

@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.3.9-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2012-07-13 10:55+0200\n"
"POT-Creation-Date: 2012-07-14 10:46+0200\n"
"PO-Revision-Date: 2012-06-03 09:49+0200\n"
"Last-Translator: Sergio Durigan Junior <sergiosdj@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -3808,6 +3808,13 @@ msgstr "%s: aviso: dicionário \"%s\" não está disponível em seu sistema"
msgid "%s%s: not enough memory to create new speller"
msgstr "%s%s: memória insuficiente para criar novo verificador ortográfico"
#, c-format
msgid ""
"%s%s: UTF-8 is now allowed in charset options (it is internal and default "
"charset: default encode is UTF-8 and decode of UTF-8 is OK even if you "
"specify another charset to decode)"
msgstr ""
#, c-format
msgid "%s%s: error creating charset \"%s\" => \"%s\""
msgstr "%s%s: erro ao criar charset \"%s\" => \"%s\""

View File

@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.3.9-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2012-07-13 10:55+0200\n"
"POT-Creation-Date: 2012-07-14 10:46+0200\n"
"PO-Revision-Date: 2012-06-03 09:49+0200\n"
"Last-Translator: Aleksey V Zapparov AKA ixti <ixti@member.fsf.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -3414,6 +3414,13 @@ msgstr ""
msgid "%s%s: not enough memory to create new speller"
msgstr "%s недостаточно памяти для нового DCC\n"
#, c-format
msgid ""
"%s%s: UTF-8 is now allowed in charset options (it is internal and default "
"charset: default encode is UTF-8 and decode of UTF-8 is OK even if you "
"specify another charset to decode)"
msgstr ""
#, fuzzy, c-format
msgid "%s%s: error creating charset \"%s\" => \"%s\""
msgstr "%s недостаточно памяти для сообщения в строке информации\n"

View File

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2012-07-13 10:55+0200\n"
"POT-Creation-Date: 2012-07-14 10:46+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -2984,6 +2984,13 @@ msgstr ""
msgid "%s%s: not enough memory to create new speller"
msgstr ""
#, c-format
msgid ""
"%s%s: UTF-8 is now allowed in charset options (it is internal and default "
"charset: default encode is UTF-8 and decode of UTF-8 is OK even if you "
"specify another charset to decode)"
msgstr ""
#, c-format
msgid "%s%s: error creating charset \"%s\" => \"%s\""
msgstr ""

View File

@ -73,6 +73,46 @@ charset_config_reload (void *data, struct t_config_file *config_file)
return weechat_config_reload (config_file);
}
/*
* charset_is_allowed: check if charset is allowed (different from "UTF-8",
* which is the internal charset)
* return 1 if charset is allowed, otherwise 0
* (and error is displayed)
*/
int
charset_is_allowed (const char *charset)
{
if (weechat_strcasestr (charset, "utf-8")
|| weechat_strcasestr (charset, "utf8"))
{
weechat_printf (NULL,
_("%s%s: UTF-8 is now allowed in charset options (it "
"is internal and default charset: default encode "
"is UTF-8 and decode of UTF-8 is OK even if you "
"specify another charset to decode)"),
weechat_prefix ("error"), CHARSET_PLUGIN_NAME);
return 0;
}
return 1;
}
/*
* charset_check_charset_cb: callback called to check the charset value
*/
int
charset_check_charset_cb (void *data, struct t_config_option *option,
const char *value)
{
/* make C compiler happy */
(void) data;
(void) option;
return charset_is_allowed (value);
}
/*
* charset_config_create_option: set a charset
*/
@ -108,13 +148,16 @@ charset_config_create_option (void *data, struct t_config_file *config_file,
{
if (value && value[0])
{
ptr_option = weechat_config_new_option (
config_file, section,
option_name, "string", NULL,
NULL, 0, 0, "", value, 0,
NULL, NULL, NULL, NULL, NULL, NULL);
rc = (ptr_option) ?
WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE : WEECHAT_CONFIG_OPTION_SET_ERROR;
if (charset_is_allowed (value))
{
ptr_option = weechat_config_new_option (
config_file, section,
option_name, "string", NULL,
NULL, 0, 0, "", value, 0,
&charset_check_charset_cb, NULL, NULL, NULL, NULL, NULL);
rc = (ptr_option) ?
WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE : WEECHAT_CONFIG_OPTION_SET_ERROR;
}
}
else
rc = WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE;
@ -167,13 +210,13 @@ charset_config_init ()
&& (strcasecmp (charset_terminal,
charset_internal) != 0)) ?
charset_terminal : "iso-8859-1", NULL, 0,
NULL, NULL, NULL, NULL, NULL, NULL);
&charset_check_charset_cb, NULL, NULL, NULL, NULL, NULL);
charset_default_encode = weechat_config_new_option (
charset_config_file, ptr_section,
"encode", "string",
N_("global encoding charset"),
NULL, 0, 0, "", NULL, 0,
NULL, NULL, NULL, NULL, NULL, NULL);
&charset_check_charset_cb, NULL, NULL, NULL, NULL, NULL);
ptr_section = weechat_config_new_section (charset_config_file, "decode",
1, 1,