1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-12-24 08:38:51 -05:00

Standardize line breaks within headers.

Fix the unit test to match.

All line endings in the unit test are now the same.

(Just for consistency.  Not a big deal, since such problems are fixed when
the messages are run through EOLConvertingOutputStream.)
This commit is contained in:
Joe Steele 2013-09-02 19:56:59 -04:00
parent 074159f442
commit 63f68328ff
4 changed files with 12 additions and 12 deletions

View File

@ -76,10 +76,10 @@ public class MimeBodyPart extends BodyPart {
setEncoding(MimeUtil.ENC_8BIT);
}
} else if (body instanceof TextBody) {
String contentType = String.format("%s;\n charset=utf-8", getMimeType());
String contentType = String.format("%s;\r\n charset=utf-8", getMimeType());
String name = MimeUtility.getHeaderParameter(getContentType(), "name");
if (name != null) {
contentType += String.format(";\n name=\"%s\"", name);
contentType += String.format(";\r\n name=\"%s\"", name);
}
setHeader(MimeHeader.HEADER_CONTENT_TYPE, contentType);
setEncoding(MimeUtil.ENC_8BIT);

View File

@ -384,7 +384,7 @@ public class MimeMessage extends Message {
setEncoding(MimeUtil.ENC_8BIT);
}
} else if (body instanceof TextBody) {
setHeader(MimeHeader.HEADER_CONTENT_TYPE, String.format("%s;\n charset=utf-8",
setHeader(MimeHeader.HEADER_CONTENT_TYPE, String.format("%s;\r\n charset=utf-8",
getMimeType()));
setEncoding(MimeUtil.ENC_8BIT);
}

View File

@ -3367,7 +3367,7 @@ public class MimeUtility {
public static void setCharset(String charset, Part part) throws MessagingException {
part.setHeader(MimeHeader.HEADER_CONTENT_TYPE,
part.getMimeType() + ";\n charset=" + getExternalCharset(charset));
part.getMimeType() + ";\r\n charset=" + getExternalCharset(charset));
}
public static String getExternalCharset(String charset) {

View File

@ -33,7 +33,7 @@ public class MessageTest extends AndroidTestCase {
+ "Content-Transfer-Encoding: 8bit\r\n"
+ "\r\n"
+ "------Boundary103\r\n"
+ "Content-Type: text/plain;\n"
+ "Content-Type: text/plain;\r\n"
+ " charset=utf-8\r\n"
+ "Content-Transfer-Encoding: 8bit\r\n"
+ "\r\n"
@ -43,7 +43,7 @@ public class MessageTest extends AndroidTestCase {
+ "End of test.\r\n"
+ "\r\n"
+ "------Boundary103\r\n"
+ "Content-Type: text/plain;\n"
+ "Content-Type: text/plain;\r\n"
+ " charset=utf-8\r\n"
+ "Content-Transfer-Encoding: quoted-printable\r\n"
+ "\r\n"
@ -72,7 +72,7 @@ public class MessageTest extends AndroidTestCase {
+ "Content-Transfer-Encoding: 8bit\r\n"
+ "\r\n"
+ "------Boundary102\r\n"
+ "Content-Type: text/plain;\n"
+ "Content-Type: text/plain;\r\n"
+ " charset=utf-8\r\n"
+ "Content-Transfer-Encoding: 8bit\r\n"
+ "\r\n"
@ -82,7 +82,7 @@ public class MessageTest extends AndroidTestCase {
+ "End of test.\r\n"
+ "\r\n"
+ "------Boundary102\r\n"
+ "Content-Type: text/plain;\n"
+ "Content-Type: text/plain;\r\n"
+ " charset=utf-8\r\n"
+ "Content-Transfer-Encoding: quoted-printable\r\n"
+ "\r\n"
@ -111,7 +111,7 @@ public class MessageTest extends AndroidTestCase {
+ "Content-Transfer-Encoding: 8bit\r\n"
+ "\r\n"
+ "------Boundary101\r\n"
+ "Content-Type: text/plain;\n"
+ "Content-Type: text/plain;\r\n"
+ " charset=utf-8\r\n"
+ "Content-Transfer-Encoding: 8bit\r\n"
+ "\r\n"
@ -121,7 +121,7 @@ public class MessageTest extends AndroidTestCase {
+ "End of test.\r\n"
+ "\r\n"
+ "------Boundary101\r\n"
+ "Content-Type: text/plain;\n"
+ "Content-Type: text/plain;\r\n"
+ " charset=utf-8\r\n"
+ "Content-Transfer-Encoding: quoted-printable\r\n"
+ "\r\n"
@ -152,7 +152,7 @@ public class MessageTest extends AndroidTestCase {
+ "Content-Transfer-Encoding: 7bit\r\n"
+ "\r\n"
+ "------Boundary103\r\n"
+ "Content-Type: text/plain;\n"
+ "Content-Type: text/plain;\r\n"
+ " charset=utf-8\r\n"
+ "Content-Transfer-Encoding: quoted-printable\r\n"
+ "\r\n"
@ -162,7 +162,7 @@ public class MessageTest extends AndroidTestCase {
+ "End of test=2E\r\n"
+ "\r\n"
+ "------Boundary103\r\n"
+ "Content-Type: text/plain;\n"
+ "Content-Type: text/plain;\r\n"
+ " charset=utf-8\r\n"
+ "Content-Transfer-Encoding: quoted-printable\r\n"
+ "\r\n"