mirror of
https://github.com/moparisthebest/k-9
synced 2024-11-27 11:42:16 -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:
parent
074159f442
commit
63f68328ff
@ -76,10 +76,10 @@ public class MimeBodyPart extends BodyPart {
|
|||||||
setEncoding(MimeUtil.ENC_8BIT);
|
setEncoding(MimeUtil.ENC_8BIT);
|
||||||
}
|
}
|
||||||
} else if (body instanceof TextBody) {
|
} 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");
|
String name = MimeUtility.getHeaderParameter(getContentType(), "name");
|
||||||
if (name != null) {
|
if (name != null) {
|
||||||
contentType += String.format(";\n name=\"%s\"", name);
|
contentType += String.format(";\r\n name=\"%s\"", name);
|
||||||
}
|
}
|
||||||
setHeader(MimeHeader.HEADER_CONTENT_TYPE, contentType);
|
setHeader(MimeHeader.HEADER_CONTENT_TYPE, contentType);
|
||||||
setEncoding(MimeUtil.ENC_8BIT);
|
setEncoding(MimeUtil.ENC_8BIT);
|
||||||
|
@ -384,7 +384,7 @@ public class MimeMessage extends Message {
|
|||||||
setEncoding(MimeUtil.ENC_8BIT);
|
setEncoding(MimeUtil.ENC_8BIT);
|
||||||
}
|
}
|
||||||
} else if (body instanceof TextBody) {
|
} 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()));
|
getMimeType()));
|
||||||
setEncoding(MimeUtil.ENC_8BIT);
|
setEncoding(MimeUtil.ENC_8BIT);
|
||||||
}
|
}
|
||||||
|
@ -3367,7 +3367,7 @@ public class MimeUtility {
|
|||||||
|
|
||||||
public static void setCharset(String charset, Part part) throws MessagingException {
|
public static void setCharset(String charset, Part part) throws MessagingException {
|
||||||
part.setHeader(MimeHeader.HEADER_CONTENT_TYPE,
|
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) {
|
public static String getExternalCharset(String charset) {
|
||||||
|
@ -33,7 +33,7 @@ public class MessageTest extends AndroidTestCase {
|
|||||||
+ "Content-Transfer-Encoding: 8bit\r\n"
|
+ "Content-Transfer-Encoding: 8bit\r\n"
|
||||||
+ "\r\n"
|
+ "\r\n"
|
||||||
+ "------Boundary103\r\n"
|
+ "------Boundary103\r\n"
|
||||||
+ "Content-Type: text/plain;\n"
|
+ "Content-Type: text/plain;\r\n"
|
||||||
+ " charset=utf-8\r\n"
|
+ " charset=utf-8\r\n"
|
||||||
+ "Content-Transfer-Encoding: 8bit\r\n"
|
+ "Content-Transfer-Encoding: 8bit\r\n"
|
||||||
+ "\r\n"
|
+ "\r\n"
|
||||||
@ -43,7 +43,7 @@ public class MessageTest extends AndroidTestCase {
|
|||||||
+ "End of test.\r\n"
|
+ "End of test.\r\n"
|
||||||
+ "\r\n"
|
+ "\r\n"
|
||||||
+ "------Boundary103\r\n"
|
+ "------Boundary103\r\n"
|
||||||
+ "Content-Type: text/plain;\n"
|
+ "Content-Type: text/plain;\r\n"
|
||||||
+ " charset=utf-8\r\n"
|
+ " charset=utf-8\r\n"
|
||||||
+ "Content-Transfer-Encoding: quoted-printable\r\n"
|
+ "Content-Transfer-Encoding: quoted-printable\r\n"
|
||||||
+ "\r\n"
|
+ "\r\n"
|
||||||
@ -72,7 +72,7 @@ public class MessageTest extends AndroidTestCase {
|
|||||||
+ "Content-Transfer-Encoding: 8bit\r\n"
|
+ "Content-Transfer-Encoding: 8bit\r\n"
|
||||||
+ "\r\n"
|
+ "\r\n"
|
||||||
+ "------Boundary102\r\n"
|
+ "------Boundary102\r\n"
|
||||||
+ "Content-Type: text/plain;\n"
|
+ "Content-Type: text/plain;\r\n"
|
||||||
+ " charset=utf-8\r\n"
|
+ " charset=utf-8\r\n"
|
||||||
+ "Content-Transfer-Encoding: 8bit\r\n"
|
+ "Content-Transfer-Encoding: 8bit\r\n"
|
||||||
+ "\r\n"
|
+ "\r\n"
|
||||||
@ -82,7 +82,7 @@ public class MessageTest extends AndroidTestCase {
|
|||||||
+ "End of test.\r\n"
|
+ "End of test.\r\n"
|
||||||
+ "\r\n"
|
+ "\r\n"
|
||||||
+ "------Boundary102\r\n"
|
+ "------Boundary102\r\n"
|
||||||
+ "Content-Type: text/plain;\n"
|
+ "Content-Type: text/plain;\r\n"
|
||||||
+ " charset=utf-8\r\n"
|
+ " charset=utf-8\r\n"
|
||||||
+ "Content-Transfer-Encoding: quoted-printable\r\n"
|
+ "Content-Transfer-Encoding: quoted-printable\r\n"
|
||||||
+ "\r\n"
|
+ "\r\n"
|
||||||
@ -111,7 +111,7 @@ public class MessageTest extends AndroidTestCase {
|
|||||||
+ "Content-Transfer-Encoding: 8bit\r\n"
|
+ "Content-Transfer-Encoding: 8bit\r\n"
|
||||||
+ "\r\n"
|
+ "\r\n"
|
||||||
+ "------Boundary101\r\n"
|
+ "------Boundary101\r\n"
|
||||||
+ "Content-Type: text/plain;\n"
|
+ "Content-Type: text/plain;\r\n"
|
||||||
+ " charset=utf-8\r\n"
|
+ " charset=utf-8\r\n"
|
||||||
+ "Content-Transfer-Encoding: 8bit\r\n"
|
+ "Content-Transfer-Encoding: 8bit\r\n"
|
||||||
+ "\r\n"
|
+ "\r\n"
|
||||||
@ -121,7 +121,7 @@ public class MessageTest extends AndroidTestCase {
|
|||||||
+ "End of test.\r\n"
|
+ "End of test.\r\n"
|
||||||
+ "\r\n"
|
+ "\r\n"
|
||||||
+ "------Boundary101\r\n"
|
+ "------Boundary101\r\n"
|
||||||
+ "Content-Type: text/plain;\n"
|
+ "Content-Type: text/plain;\r\n"
|
||||||
+ " charset=utf-8\r\n"
|
+ " charset=utf-8\r\n"
|
||||||
+ "Content-Transfer-Encoding: quoted-printable\r\n"
|
+ "Content-Transfer-Encoding: quoted-printable\r\n"
|
||||||
+ "\r\n"
|
+ "\r\n"
|
||||||
@ -152,7 +152,7 @@ public class MessageTest extends AndroidTestCase {
|
|||||||
+ "Content-Transfer-Encoding: 7bit\r\n"
|
+ "Content-Transfer-Encoding: 7bit\r\n"
|
||||||
+ "\r\n"
|
+ "\r\n"
|
||||||
+ "------Boundary103\r\n"
|
+ "------Boundary103\r\n"
|
||||||
+ "Content-Type: text/plain;\n"
|
+ "Content-Type: text/plain;\r\n"
|
||||||
+ " charset=utf-8\r\n"
|
+ " charset=utf-8\r\n"
|
||||||
+ "Content-Transfer-Encoding: quoted-printable\r\n"
|
+ "Content-Transfer-Encoding: quoted-printable\r\n"
|
||||||
+ "\r\n"
|
+ "\r\n"
|
||||||
@ -162,7 +162,7 @@ public class MessageTest extends AndroidTestCase {
|
|||||||
+ "End of test=2E\r\n"
|
+ "End of test=2E\r\n"
|
||||||
+ "\r\n"
|
+ "\r\n"
|
||||||
+ "------Boundary103\r\n"
|
+ "------Boundary103\r\n"
|
||||||
+ "Content-Type: text/plain;\n"
|
+ "Content-Type: text/plain;\r\n"
|
||||||
+ " charset=utf-8\r\n"
|
+ " charset=utf-8\r\n"
|
||||||
+ "Content-Transfer-Encoding: quoted-printable\r\n"
|
+ "Content-Transfer-Encoding: quoted-printable\r\n"
|
||||||
+ "\r\n"
|
+ "\r\n"
|
||||||
|
Loading…
Reference in New Issue
Block a user