\n"); + "style=\"margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;\">\r\n"); String footer = "
- * We create drafts with LF line endings. The values in the identity header are based on that. - * So we replace CRLF with LF when loading messages (from the server). - *
- * - * @param text - * The body text with CRLF line endings - * - * @return The text with LF line endings - */ - private static String fixDraftTextBody(String text) { - return text.replace("\r\n", "\n"); - } } diff --git a/src/com/fsck/k9/mail/store/ImapStore.java b/src/com/fsck/k9/mail/store/ImapStore.java index e2bbfa0f1..fd1876558 100644 --- a/src/com/fsck/k9/mail/store/ImapStore.java +++ b/src/com/fsck/k9/mail/store/ImapStore.java @@ -1917,7 +1917,7 @@ public class ImapStore extends Store { * of them. */ for (int i = 0, count = bodyParams.size(); i < count; i += 2) { - contentType.append(String.format(";\n %s=\"%s\"", + contentType.append(String.format(";\r\n %s=\"%s\"", bodyParams.getString(i), bodyParams.getString(i + 1))); } @@ -1952,7 +1952,7 @@ public class ImapStore extends Store { * about the attachment out. */ for (int i = 0, count = bodyDispositionParams.size(); i < count; i += 2) { - contentDisposition.append(String.format(";\n %s=\"%s\"", + contentDisposition.append(String.format(";\r\n %s=\"%s\"", bodyDispositionParams.getString(i).toLowerCase(Locale.US), bodyDispositionParams.getString(i + 1))); } @@ -1960,7 +1960,7 @@ public class ImapStore extends Store { } if (MimeUtility.getHeaderParameter(contentDisposition.toString(), "size") == null) { - contentDisposition.append(String.format(";\n size=%d", size)); + contentDisposition.append(String.format(";\r\n size=%d", size)); } /* diff --git a/src/com/fsck/k9/mail/store/LocalStore.java b/src/com/fsck/k9/mail/store/LocalStore.java index 0d16a5210..c66cc5e44 100644 --- a/src/com/fsck/k9/mail/store/LocalStore.java +++ b/src/com/fsck/k9/mail/store/LocalStore.java @@ -1964,18 +1964,18 @@ public class LocalStore extends Store implements Serializable { bp.setEncoding(encoding); if (name != null) { bp.setHeader(MimeHeader.HEADER_CONTENT_TYPE, - String.format("%s;\n name=\"%s\"", + String.format("%s;\r\n name=\"%s\"", type, name)); bp.setHeader(MimeHeader.HEADER_CONTENT_DISPOSITION, - String.format("%s;\n filename=\"%s\";\n size=%d", + String.format("%s;\r\n filename=\"%s\";\r\n size=%d", contentDisposition, name, // TODO: Should use encoded word defined in RFC 2231. size)); } else { bp.setHeader(MimeHeader.HEADER_CONTENT_TYPE, type); bp.setHeader(MimeHeader.HEADER_CONTENT_DISPOSITION, - String.format("%s;\n size=%d", + String.format("%s;\r\n size=%d", contentDisposition, size)); } diff --git a/tests/src/com/fsck/k9/helper/HtmlConverterTest.java b/tests/src/com/fsck/k9/helper/HtmlConverterTest.java index e5477be78..ed0c876c9 100644 --- a/tests/src/com/fsck/k9/helper/HtmlConverterTest.java +++ b/tests/src/com/fsck/k9/helper/HtmlConverterTest.java @@ -12,16 +12,16 @@ public class HtmlConverterTest extends TestCase { private static final String OUTPUT_FILE = "C:/temp/parse.html"; public void testTextQuoteToHtmlBlockquote() { - String message = "Panama!\n" + - "\n" + - "Bob Barker" @@ -150,11 +150,11 @@ public class HtmlConverterTest extends TestCase { public void testPreserveSpacesAtFirstForSpecialCharacters() { String message = - " \n" - + " &\n" - + " \r\n" - + " <\n" - + " > \n"; + " \r\n" + + " &\r\n" + + " \n" + + " <\r\n" + + " > \r\n"; String result = HtmlConverter.textToHtml(message); writeToFile(result); assertEquals("" diff --git a/tests/src/com/fsck/k9/mail/internet/ViewablesTest.java b/tests/src/com/fsck/k9/mail/internet/ViewablesTest.java index f10ad791a..cb62079f3 100644 --- a/tests/src/com/fsck/k9/mail/internet/ViewablesTest.java +++ b/tests/src/com/fsck/k9/mail/internet/ViewablesTest.java @@ -81,8 +81,8 @@ public class ViewablesTest extends AndroidTestCase { ViewableContainer container = MimeUtility.extractTextAndAttachments(getContext(), message); String expectedText = - bodyText1 + "\n\n" + - "------------------------------------------------------------------------\n\n" + + bodyText1 + "\r\n\r\n" + + "------------------------------------------------------------------------\r\n\r\n" + bodyText2; String expectedHtml = "" + @@ -138,14 +138,14 @@ public class ViewablesTest extends AndroidTestCase { String expectedText = bodyText + - "\n\n" + + "\r\n\r\n" + "----- message.eml ------------------------------------------------------" + - "\n\n" + - "From: from@example.com" + "\n" + - "To: to@example.com" + "\n" + - "Sent: Sat Mar 17 00:00:00 GMT+01:00 2012" + "\n" + - "Subject: Subject" + "\n" + - "\n" + + "\r\n\r\n" + + "From: from@example.com" + "\r\n" + + "To: to@example.com" + "\r\n" + + "Sent: Sat Mar 17 00:00:00 GMT+01:00 2012" + "\r\n" + + "Subject: Subject" + "\r\n" + + "\r\n" + innerBodyText; String expectedHtml = "" +