Commit bf4fb2a0 authored by Hussein's avatar Hussein

Merge branch 'bug/P4A-1018' into develop

parents c8a7bf74 8802f969
......@@ -78,7 +78,7 @@ class PEpMessageBuilder {
// return;
}
String charset = getMessageCharset();
String charset = getMessagePartCharset(mm);
String text = new String(PEpUtils.extractBodyContent(b), charset);
if(mm.isMimeType("text/html")) {
pEpMsg.setLongmsgFormatted(text);
......@@ -94,8 +94,12 @@ class PEpMessageBuilder {
pEpMsg.setAttachments(attachments);
}
private String getMessageCharset() {
String charset = MimeUtility.getHeaderParameter(mm.getContentType(), "charset");
private String getMessagePartCharset(Part part) {
String charset = MimeUtility.getHeaderParameter(part.getContentType(), "charset");
if (charset == null) {
charset = MimeUtility.getHeaderParameter(mm.getContentType(), "charset");
}
if (charset == null || !Charset.isSupported(charset)) {
// failback when the header doesn't have charset parameter or it is invalid, defaults to UTF-8
......@@ -123,7 +127,7 @@ class PEpMessageBuilder {
boolean plain = mbp.isMimeType("text/plain");
if (!isAnAttachment(mbp) && (plain || mbp.isMimeType("text/html"))) {
String charset = getMessageCharset();
String charset = getMessagePartCharset(mbp);
String text = new String(PEpUtils.extractBodyContent(mbp_body), charset);
if (plain) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment