diff --git a/src/com/fsck/k9/mail/internet/MimeUtility.java b/src/com/fsck/k9/mail/internet/MimeUtility.java index e9abb3a1a..55b360cde 100644 --- a/src/com/fsck/k9/mail/internet/MimeUtility.java +++ b/src/com/fsck/k9/mail/internet/MimeUtility.java @@ -956,7 +956,7 @@ public class MimeUtility { header = header.replaceAll("\r|\n", ""); String[] parts = header.split(";"); if (name == null && parts.length > 0) { - return parts[0]; + return parts[0].trim(); } for (String part : parts) { if (part.trim().toLowerCase(Locale.US).startsWith(name.toLowerCase(Locale.US))) { diff --git a/tests/src/com/fsck/k9/mail/internet/MimeUtilityTest.java b/tests/src/com/fsck/k9/mail/internet/MimeUtilityTest.java index 8bf122395..900daec60 100644 --- a/tests/src/com/fsck/k9/mail/internet/MimeUtilityTest.java +++ b/tests/src/com/fsck/k9/mail/internet/MimeUtilityTest.java @@ -35,5 +35,8 @@ public class MimeUtilityTest extends AndroidTestCase { result = MimeUtility.getHeaderParameter("name=\"\"", "name"); assertEquals("", result); + + result = MimeUtility.getHeaderParameter("text/html ; charset=\"windows-1251\"", null); + assertEquals("text/html", result); } }