2010-02-10 [colin] 3.7.5cvs16
authorColin Leroy <colin@colino.net>
Wed, 10 Feb 2010 07:53:44 +0000 (07:53 +0000)
committerColin Leroy <colin@colino.net>
Wed, 10 Feb 2010 07:53:44 +0000 (07:53 +0000)
* src/codeconv.c
* src/codeconv.h
* src/compose.c
* src/mainwindow.c
* src/messageview.c
* src/prefs_send.c
* src/procmime.c
* src/textview.c
Add the GB18030 Chinese charset, which is a superset
of GB2312 and (X-)GBK. Patch mostly by Yuwei Yu.

ChangeLog
PATCHSETS
configure.ac
src/codeconv.c
src/codeconv.h
src/compose.c
src/mainwindow.c
src/messageview.c
src/prefs_send.c
src/procmime.c
src/textview.c

index d09e764..e00928b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2010-02-10 [colin]     3.7.5cvs16
+
+       * src/codeconv.c
+       * src/codeconv.h
+       * src/compose.c
+       * src/mainwindow.c
+       * src/messageview.c
+       * src/prefs_send.c
+       * src/procmime.c
+       * src/textview.c
+               Add the GB18030 Chinese charset, which is a superset
+               of GB2312 and (X-)GBK. Patch mostly by Yuwei Yu.
+
 2010-02-09 [holger]    3.7.5cvs15
 
        * configure.ac
index bb6f65a..6c489e7 100644 (file)
--- a/PATCHSETS
+++ b/PATCHSETS
 ( cvs diff -u -r 1.53.2.35 -r 1.53.2.36 po/POTFILES.in;  ) > 3.7.5cvs13.patchset
 ( cvs diff -u -r 1.105.2.157 -r 1.105.2.158 src/prefs_account.c;  cvs diff -u -r 1.52.2.78 -r 1.52.2.79 src/prefs_folder_item.c;  cvs diff -u -r 1.12.2.72 -r 1.12.2.73 src/prefs_template.c;  cvs diff -u -r 1.8.2.41 -r 1.8.2.42 src/quote_fmt.c;  ) > 3.7.5cvs14.patchset
 ( cvs diff -u -r 1.654.2.4027 -r 1.654.2.4028 configure.ac;  ) > 3.7.5cvs15.patchset
+( cvs diff -u -r 1.65.2.69 -r 1.65.2.70 src/codeconv.c;  cvs diff -u -r 1.15.2.23 -r 1.15.2.24 src/codeconv.h;  cvs diff -u -r 1.382.2.544 -r 1.382.2.545 src/compose.c;  cvs diff -u -r 1.274.2.305 -r 1.274.2.306 src/mainwindow.c;  cvs diff -u -r 1.94.2.209 -r 1.94.2.210 src/messageview.c;  cvs diff -u -r 1.1.2.26 -r 1.1.2.27 src/prefs_send.c;  cvs diff -u -r 1.49.2.131 -r 1.49.2.132 src/procmime.c;  cvs diff -u -r 1.96.2.221 -r 1.96.2.222 src/textview.c;  ) > 3.7.5cvs16.patchset
index d7a0861..ecf0c8f 100644 (file)
@@ -12,7 +12,7 @@ MINOR_VERSION=7
 MICRO_VERSION=5
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=15
+EXTRA_VERSION=16
 EXTRA_RELEASE=
 EXTRA_GTK2_VERSION=
 
index 672cf22..629e88a 100644 (file)
@@ -1028,6 +1028,7 @@ static const struct {
        {C_EUC_KR,              CS_EUC_KR},
        {C_ISO_2022_CN,         CS_ISO_2022_CN},
        {C_EUC_CN,              CS_EUC_CN},
+       {C_GB18030,             CS_GB18030},
        {C_GB2312,              CS_GB2312},
        {C_GBK,                 CS_GBK},
        {C_EUC_TW,              CS_EUC_TW},
@@ -1057,9 +1058,10 @@ static const struct {
 #endif
        {"ko_KR.EUC-KR" , C_EUC_KR      , C_EUC_KR},
        {"ko_KR"        , C_EUC_KR      , C_EUC_KR},
+       {"zh_CN.GB18030"        , C_GB18030     , C_GB18030},
        {"zh_CN.GB2312" , C_GB2312      , C_GB2312},
        {"zh_CN.GBK"    , C_GBK         , C_GBK},
-       {"zh_CN"        , C_GB2312      , C_GB2312},
+       {"zh_CN"        , C_GB18030     , C_GB18030},
        {"zh_HK"        , C_BIG5_HKSCS  , C_BIG5_HKSCS},
        {"zh_TW.eucTW"  , C_EUC_TW      , C_BIG5},
        {"zh_TW.EUC-TW" , C_EUC_TW      , C_BIG5},
index 3829e37..5856d87 100644 (file)
@@ -81,6 +81,7 @@ typedef enum
        C_EUC_KR,
        C_ISO_2022_CN,
        C_EUC_CN,
+       C_GB18030,
        C_GB2312,
        C_GBK,
        C_EUC_TW,
@@ -156,6 +157,7 @@ struct _CodeConverter
 #define CS_EUC_KR              "EUC-KR"
 #define CS_ISO_2022_CN         "ISO-2022-CN"
 #define CS_EUC_CN              "EUC-CN"
+#define CS_GB18030             "GB18030"
 #define CS_GB2312              "GB2312"
 #define CS_GBK                 "GBK"
 #define CS_X_GBK               "X-GBK"
index 0b264cf..2579020 100644 (file)
@@ -710,6 +710,7 @@ static GtkRadioActionEntry compose_radio_enc_entries[] =
        ENC_ACTION("Japanese/"CS_ISO_2022_JP_2, C_ISO_2022_JP_2, "ISO-2022-JP-_2"), /* RADIO compose_set_encoding_cb */
        ENC_ACTION("Japanese/"CS_EUC_JP, C_EUC_JP, "_EUC-JP"), /* RADIO compose_set_encoding_cb */
        ENC_ACTION("Japanese/"CS_SHIFT_JIS, C_SHIFT_JIS, "_Shift-JIS"), /* RADIO compose_set_encoding_cb */
+       ENC_ACTION("Chinese/"CS_GB18030, C_GB18030, "_GB18030"), /* RADIO compose_set_encoding_cb */
        ENC_ACTION("Chinese/"CS_GB2312, C_GB2312, "_GB2312"), /* RADIO compose_set_encoding_cb */
        ENC_ACTION("Chinese/"CS_GBK, C_GBK, "GB_K"), /* RADIO compose_set_encoding_cb */
        ENC_ACTION("Chinese/"CS_BIG5, C_BIG5, "_Big5-JP"), /* RADIO compose_set_encoding_cb */
@@ -7244,6 +7245,7 @@ static Compose *compose_create(PrefsAccount *account,
        MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Menu/Options/Encoding/Japanese", CS_SHIFT_JIS, "Options/Encoding/Japanese/"CS_SHIFT_JIS, GTK_UI_MANAGER_MENUITEM)
 
        MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Menu/Options/Encoding", "Chinese", "Options/Encoding/Chinese", GTK_UI_MANAGER_MENU)
+       MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Menu/Options/Encoding/Chinese", CS_GB18030, "Options/Encoding/Chinese/"CS_GB18030, GTK_UI_MANAGER_MENUITEM)
        MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Menu/Options/Encoding/Chinese", CS_GB2312, "Options/Encoding/Chinese/"CS_GB2312, GTK_UI_MANAGER_MENUITEM)
        MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Menu/Options/Encoding/Chinese", CS_GBK, "Options/Encoding/Chinese/"CS_GBK, GTK_UI_MANAGER_MENUITEM)
        MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Menu/Options/Encoding/Chinese", CS_BIG5, "Options/Encoding/Chinese/"CS_BIG5, GTK_UI_MANAGER_MENUITEM)
@@ -7910,6 +7912,7 @@ static void compose_set_out_encoding(Compose *compose)
                case C_ISO_2022_JP_2: branch = "Menu/Options/Encoding/Japanese/" CS_ISO_2022_JP_2; break;
                case C_EUC_JP: branch = "Menu/Options/Encoding/Japanese/" CS_EUC_JP; break;
                case C_SHIFT_JIS: branch = "Menu/Options/Encoding/Japanese/" CS_SHIFT_JIS; break;
+               case C_GB18030: branch = "Menu/Options/Encoding/Chinese/" CS_GB18030; break;
                case C_GB2312: branch = "Menu/Options/Encoding/Chinese/" CS_GB2312; break;
                case C_GBK: branch = "Menu/Options/Encoding/Chinese/" CS_GBK; break;
                case C_BIG5: branch = "Menu/Options/Encoding/Chinese/" CS_BIG5; break;
index 5a92eff..7da4430 100644 (file)
@@ -824,6 +824,7 @@ static GtkRadioActionEntry mainwin_radio_enc_entries[] =
        ENC_ACTION("Japanese/"CS_ISO_2022_JP_2, C_ISO_2022_JP_2, "ISO-2022-JP-_2"), /* RADIO set_charset_cb */
        ENC_ACTION("Japanese/"CS_EUC_JP, C_EUC_JP, "_EUC-JP"), /* RADIO set_charset_cb */
        ENC_ACTION("Japanese/"CS_SHIFT_JIS, C_SHIFT_JIS, "_Shift-JIS"), /* RADIO set_charset_cb */
+       ENC_ACTION("Chinese/"CS_GB18030, C_GB18030, "_GB18030"), /* RADIO set_charset_cb */
        ENC_ACTION("Chinese/"CS_GB2312, C_GB2312, "_GB2312"), /* RADIO set_charset_cb */
        ENC_ACTION("Chinese/"CS_GBK, C_GBK, "GB_K"), /* RADIO set_charset_cb */
        ENC_ACTION("Chinese/"CS_BIG5, C_BIG5, "_Big5-JP"), /* RADIO set_charset_cb */
@@ -1766,6 +1767,7 @@ MainWindow *main_window_create()
        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Encoding/Japanese", CS_SHIFT_JIS, "View/Encoding/Japanese/"CS_SHIFT_JIS, GTK_UI_MANAGER_MENUITEM)
 
        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Encoding", "Chinese", "View/Encoding/Chinese", GTK_UI_MANAGER_MENU)
+       MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Encoding/Chinese", CS_GB18030, "View/Encoding/Chinese/"CS_GB18030, GTK_UI_MANAGER_MENUITEM)
        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Encoding/Chinese", CS_GB2312, "View/Encoding/Chinese/"CS_GB2312, GTK_UI_MANAGER_MENUITEM)
        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Encoding/Chinese", CS_GBK, "View/Encoding/Chinese/"CS_GBK, GTK_UI_MANAGER_MENUITEM)
        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Encoding/Chinese", CS_BIG5, "View/Encoding/Chinese/"CS_BIG5, GTK_UI_MANAGER_MENUITEM)
index 6c3f286..5a9d728 100644 (file)
@@ -328,6 +328,7 @@ static GtkRadioActionEntry msgview_radio_enc_entries[] =
        ENC_ACTION("Japanese/"CS_ISO_2022_JP_2, C_ISO_2022_JP_2, "ISO-2022-JP-_2"), /* RADIO set_charset_cb */
        ENC_ACTION("Japanese/"CS_EUC_JP, C_EUC_JP, "_EUC-JP"), /* RADIO set_charset_cb */
        ENC_ACTION("Japanese/"CS_SHIFT_JIS, C_SHIFT_JIS, "_Shift-JIS"), /* RADIO set_charset_cb */
+       ENC_ACTION("Chinese/"CS_GB18030, C_GB18030, "_GB18030"), /* RADIO set_charset_cb */
        ENC_ACTION("Chinese/"CS_GB2312, C_GB2312, "_GB2312"), /* RADIO set_charset_cb */
        ENC_ACTION("Chinese/"CS_GBK, C_GBK, "GB_K"), /* RADIO set_charset_cb */
        ENC_ACTION("Chinese/"CS_BIG5, C_BIG5, "_Big5-JP"), /* RADIO set_charset_cb */
@@ -528,6 +529,7 @@ static void messageview_add_toolbar(MessageView *msgview, GtkWidget *window)
        MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/View/Encoding/Japanese", CS_SHIFT_JIS, "View/Encoding/Japanese/"CS_SHIFT_JIS, GTK_UI_MANAGER_MENUITEM)
 
        MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/View/Encoding", "Chinese", "View/Encoding/Chinese", GTK_UI_MANAGER_MENU)
+       MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/View/Encoding/Chinese", CS_GB18030, "View/Encoding/Chinese/"CS_GB18030, GTK_UI_MANAGER_MENUITEM)
        MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/View/Encoding/Chinese", CS_GB2312, "View/Encoding/Chinese/"CS_GB2312, GTK_UI_MANAGER_MENUITEM)
        MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/View/Encoding/Chinese", CS_GBK, "View/Encoding/Chinese/"CS_GBK, GTK_UI_MANAGER_MENUITEM)
        MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/View/Encoding/Chinese", CS_BIG5, "View/Encoding/Chinese/"CS_BIG5, GTK_UI_MANAGER_MENUITEM)
index 3171bbf..429a24b 100644 (file)
@@ -247,6 +247,7 @@ static void prefs_send_create_widget(PrefsPage *_page, GtkWindow *window,
        SET_MENUITEM(_("Japanese (Shift_JIS)"),          CS_SHIFT_JIS);
 #endif /* 0 */
        SET_MENUITEM(NULL, NULL);
+       SET_MENUITEM(_("Simplified Chinese (GB18030)"),  CS_GB18030);
        SET_MENUITEM(_("Simplified Chinese (GB2312)"),   CS_GB2312);
        SET_MENUITEM(_("Simplified Chinese (GBK)"),      CS_GBK);
        SET_MENUITEM(_("Traditional Chinese (Big5)"),    CS_BIG5);
index 4be614e..2365be5 100644 (file)
@@ -711,8 +711,15 @@ static FILE *procmime_get_text_content(MimeInfo *mimeinfo)
                      ? forced_charset : 
                      procmime_mimeinfo_get_parameter(mimeinfo, "charset");
 
+       /* use supersets transparently when possible */
        if (!forced_charset && src_codeset && !strcasecmp(src_codeset, CS_ISO_8859_1))
                src_codeset = CS_WINDOWS_1252;
+       else if (!forced_charset && src_codeset && !strcasecmp(src_codeset, CS_X_GBK))
+               src_codeset = CS_GB18030;
+       else if (!forced_charset && src_codeset && !strcasecmp(src_codeset, CS_GBK))
+               src_codeset = CS_GB18030;
+       else if (!forced_charset && src_codeset && !strcasecmp(src_codeset, CS_GB2312))
+               src_codeset = CS_GB18030;
 
        if (mimeinfo->type == MIMETYPE_TEXT && !g_ascii_strcasecmp(mimeinfo->subtype, "html")) {
                SC_HTMLParser *parser;
index 620e3b7..2d0901b 100644 (file)
@@ -933,9 +933,16 @@ static void textview_write_body(TextView *textview, MimeInfo *mimeinfo)
        if (textview->messageview->forced_charset)
                charset = textview->messageview->forced_charset;
        else {
+               /* use supersets transparently when possible */
                charset = procmime_mimeinfo_get_parameter(mimeinfo, "charset");
                if (charset && !strcasecmp(charset, CS_ISO_8859_1))
                        charset = CS_WINDOWS_1252;
+               else if (charset && !strcasecmp(charset, CS_X_GBK))
+                       charset = CS_GB18030;
+               else if (charset && !strcasecmp(charset, CS_GBK))
+                       charset = CS_GB18030;
+               else if (charset && !strcasecmp(charset, CS_GB2312))
+                       charset = CS_GB18030;
        }
 
        textview_set_font(textview, charset);