X-Git-Url: http://git.madism.org/?p=apps%2Fmadmutt.git;a=blobdiff_plain;f=charset.cpkg;h=b2b4d79663e97056d58b3721fe7c2cf880da1a02;hp=f491e05f9aacdcd92a0337f1b42c43c700b99aa7;hb=64a23f5574b096605383ef1886c7d0d6c42aeeee;hpb=5f0d69cc13a116be64a243c07bad259af7d90397 diff --git a/charset.cpkg b/charset.cpkg index f491e05..b2b4d79 100644 --- a/charset.cpkg +++ b/charset.cpkg @@ -128,13 +128,13 @@ static void charset_onchange(const char *cset) void charset_hook(rx_t local, const string_t alias) { rx_set_template(local, alias); - rx_list_append(&charset_hooks, local); + rx_list_add2(&charset_hooks, &local); RETURN(); }; void iconv_hook(rx_t local, const string_t alias) { rx_set_template(local, alias); - rx_list_append(&iconv_hooks, local); + rx_list_add2(&iconv_hooks, &local); RETURN(); }; }; @@ -209,8 +209,8 @@ int charset_is_us_ascii(const char *s) /* Like iconv_open, but canonicalises the charsets */ iconv_t mutt_iconv_open(const char *tocode, const char *fromcode, int flags) { - char to1[STRING]; - char from1[STRING]; + char to1[STRING], to2[STRING]; + char from1[STRING], from2[STRING]; char tmp[STRING]; iconv_t cd; @@ -231,14 +231,10 @@ iconv_t mutt_iconv_open(const char *tocode, const char *fromcode, int flags) if ((cd = iconv_open(to1, from1)) != MUTT_ICONV_ERROR) return cd; - { - char to2[STRING]; - char from2[STRING]; + if (rx_list_match2(iconv_hooks, to1, to2, sizeof(to2)) + && rx_list_match2(iconv_hooks, from1, from2, sizeof(from2))) + return iconv_open(to2, from2); - if (rx_list_match2(iconv_hooks, to1, to2, sizeof(to2)) - && rx_list_match2(iconv_hooks, from1, from2, sizeof(from2))) - return iconv_open(to2, from2); - } return MUTT_ICONV_ERROR; }