- ssize_t i;
- char *p;
- char scratch[LONG_STRING];
-
- /* catch some common iso-8859-something misspellings */
- if (!ascii_strncasecmp (name, "8859", 4) && name[4] != '-')
- snprintf (scratch, sizeof (scratch), "iso-8859-%s", name + 4);
- else if (!ascii_strncasecmp (name, "8859-", 5))
- snprintf (scratch, sizeof (scratch), "iso-8859-%s", name + 5);
- else if (!ascii_strncasecmp (name, "iso8859", 7) && name[7] != '-')
- snprintf (scratch, sizeof (scratch), "iso_8859-%s", name + 7);
- else if (!ascii_strncasecmp (name, "iso8859-", 8))
- snprintf (scratch, sizeof (scratch), "iso_8859-%s", name + 8);
- else
- m_strcpy(scratch, sizeof(scratch), NONULL(name));
-
- for (i = 0; PreferredMIMENames[i].key; i++)
- if (!ascii_strcasecmp (scratch, PreferredMIMENames[i].key) ||
- !m_strcasecmp(scratch, PreferredMIMENames[i].key)) {
- m_strcpy(dest, dlen, PreferredMIMENames[i].pref);
- return;
+ ssize_t i;
+ char *p;
+ char scratch[LONG_STRING];
+
+ m_strcpy(scratch, sizeof(scratch), name);
+ m_strtolower(scratch);
+
+ /* catch some common iso-8859-something misspellings */
+ if (!strncmp(scratch, "8859", 4)) {
+ snprintf(scratch, sizeof(scratch), "iso-8859-%s",
+ name + 4 + (name[4] == '-'));
+ m_strtolower(scratch);
+ } else
+ if (!strncmp(scratch, "iso8859", 7)) {
+ snprintf(scratch, sizeof(scratch), "iso-8859-%s",
+ name + 7 + (name[7] == '-'));
+ m_strtolower(scratch);