Rework in charset code. (Includes renaming.)
[mmh] / sbr / fmt_rfc2047.c
index dc123e5..4e8231f 100644 (file)
@@ -125,22 +125,25 @@ decode_rfc2047(char *str, char *dst, size_t dstlen)
 
                        if (!*pp)
                                continue;
+                       *pp = '\0';
 
                        /* Check if character set can be handled natively */
-                       if (!check_charset(startofmime, pp - startofmime)) {
+                       if (!is_native_charset(startofmime)) {
 #ifdef HAVE_ICONV
                                /* .. it can't. We'll use iconv then. */
-                               *pp = '\0';
                                cd = iconv_open(get_charset(), startofmime);
                                fromutf8 = !mh_strcasecmp(startofmime, "UTF-8");
                                *pp = '?';
-                               if (cd == (iconv_t)-1) continue;
+                               if (cd == (iconv_t)-1)
+                                       continue;
                                use_iconv = 1;
 #else
+                               *pp = '?';
                                continue;
 #endif
                        }
 
+                       *pp = '?';
                        startofmime = pp + 1;
 
                        /* Check for valid encoding type */