mirror of
https://github.com/M66B/FairEmail.git
synced 2026-04-06 00:53:26 +02:00
Always specify charset for email addresses
This commit is contained in:
@@ -1654,7 +1654,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
||||
InternetAddress via = null;
|
||||
if (message.identityEmail != null)
|
||||
try {
|
||||
via = new InternetAddress(message.identityEmail, message.identityName);
|
||||
via = new InternetAddress(message.identityEmail, message.identityName, StandardCharsets.UTF_8.name());
|
||||
} catch (UnsupportedEncodingException ignored) {
|
||||
}
|
||||
|
||||
|
||||
@@ -39,6 +39,7 @@ import org.json.JSONObject;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
@@ -420,7 +421,7 @@ public class EntityRule {
|
||||
if (answer == null)
|
||||
throw new IllegalArgumentException("Rule answer not found name=" + name);
|
||||
|
||||
Address[] from = new InternetAddress[]{new InternetAddress(identity.email, identity.name)};
|
||||
Address[] from = new InternetAddress[]{new InternetAddress(identity.email, identity.name, StandardCharsets.UTF_8.name())};
|
||||
|
||||
// Prevent loop
|
||||
List<EntityMessage> messages = db.message().getMessagesByThread(
|
||||
|
||||
@@ -150,6 +150,7 @@ import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.net.UnknownHostException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.security.GeneralSecurityException;
|
||||
import java.security.PrivateKey;
|
||||
import java.security.cert.CertificateException;
|
||||
@@ -1829,7 +1830,7 @@ public class FragmentCompose extends FragmentBase {
|
||||
if (address != null)
|
||||
list.addAll(Arrays.asList(address));
|
||||
|
||||
list.add(new InternetAddress(email, name));
|
||||
list.add(new InternetAddress(email, name, StandardCharsets.UTF_8.name()));
|
||||
|
||||
if (requestCode == REQUEST_CONTACT_TO)
|
||||
draft.to = list.toArray(new Address[0]);
|
||||
@@ -2679,7 +2680,7 @@ public class FragmentCompose extends FragmentBase {
|
||||
if (contact != null && contact.moveToNext()) {
|
||||
String name = contact.getString(0);
|
||||
String email = contact.getString(1);
|
||||
selected.add(new InternetAddress(email, name));
|
||||
selected.add(new InternetAddress(email, name, StandardCharsets.UTF_8.name()));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3584,7 +3585,7 @@ public class FragmentCompose extends FragmentBase {
|
||||
data.draft.account = drafts.account;
|
||||
data.draft.folder = drafts.id;
|
||||
data.draft.identity = selected.id;
|
||||
data.draft.from = new InternetAddress[]{new InternetAddress(selected.email, selected.name)};
|
||||
data.draft.from = new InternetAddress[]{new InternetAddress(selected.email, selected.name, StandardCharsets.UTF_8.name())};
|
||||
|
||||
data.draft.sender = MessageHelper.getSortKey(data.draft.from);
|
||||
Uri lookupUri = ContactInfo.getLookupUri(data.draft.from);
|
||||
@@ -3631,7 +3632,7 @@ public class FragmentCompose extends FragmentBase {
|
||||
String email = organizer.getEmail();
|
||||
String name = organizer.getCommonName();
|
||||
if (!TextUtils.isEmpty(email)) {
|
||||
InternetAddress o = new InternetAddress(email, name);
|
||||
InternetAddress o = new InternetAddress(email, name, StandardCharsets.UTF_8.name());
|
||||
Log.i("Setting organizer=" + o);
|
||||
data.draft.to = new Address[]{o};
|
||||
}
|
||||
@@ -4049,7 +4050,7 @@ public class FragmentCompose extends FragmentBase {
|
||||
List<EntityAttachment> attachments = db.attachment().getAttachments(draft.id);
|
||||
|
||||
// Get data
|
||||
InternetAddress[] afrom = (identity == null ? null : new InternetAddress[]{new InternetAddress(identity.email, identity.name)});
|
||||
InternetAddress[] afrom = (identity == null ? null : new InternetAddress[]{new InternetAddress(identity.email, identity.name, StandardCharsets.UTF_8.name())});
|
||||
InternetAddress[] ato = (TextUtils.isEmpty(to) ? null : InternetAddress.parseHeader(to, false));
|
||||
InternetAddress[] acc = (TextUtils.isEmpty(cc) ? null : InternetAddress.parseHeader(cc, false));
|
||||
InternetAddress[] abcc = (TextUtils.isEmpty(bcc) ? null : InternetAddress.parseHeader(bcc, false));
|
||||
|
||||
@@ -81,6 +81,7 @@ import java.io.OutputStream;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.lang.reflect.Array;
|
||||
import java.net.SocketException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.security.cert.CertPathValidatorException;
|
||||
import java.text.DateFormat;
|
||||
import java.util.ArrayList;
|
||||
@@ -1422,7 +1423,7 @@ public class Log {
|
||||
}
|
||||
|
||||
static InternetAddress myAddress() throws UnsupportedEncodingException {
|
||||
return new InternetAddress("marcel+fairemail@faircode.eu", "FairCode");
|
||||
return new InternetAddress("marcel+fairemail@faircode.eu", "FairCode", StandardCharsets.UTF_8.name());
|
||||
}
|
||||
|
||||
static boolean isSupportedDevice() {
|
||||
|
||||
@@ -198,7 +198,7 @@ public class MessageHelper {
|
||||
name = null;
|
||||
Log.i("extra=" + email);
|
||||
}
|
||||
imessage.setFrom(new InternetAddress(email, name));
|
||||
imessage.setFrom(new InternetAddress(email, name, StandardCharsets.UTF_8.name()));
|
||||
}
|
||||
|
||||
if (message.to != null && message.to.length > 0)
|
||||
|
||||
@@ -38,6 +38,7 @@ import org.json.JSONException;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
@@ -312,7 +313,7 @@ public class ServiceUI extends IntentService {
|
||||
reply.inreplyto = ref.msgid;
|
||||
reply.thread = ref.thread;
|
||||
reply.to = ref.from;
|
||||
reply.from = new Address[]{new InternetAddress(identity.email, identity.name)};
|
||||
reply.from = new Address[]{new InternetAddress(identity.email, identity.name, StandardCharsets.UTF_8.name())};
|
||||
reply.subject = getString(R.string.title_subject_reply, subject);
|
||||
reply.received = new Date().getTime();
|
||||
reply.seen = true;
|
||||
|
||||
Reference in New Issue
Block a user