1
0
Fork 0
mirror of https://github.com/M66B/FairEmail.git synced 2024-12-22 07:42:52 +00:00

Skip punycode for single scripts

This commit is contained in:
M66B 2024-12-02 16:11:27 +01:00
parent 7a2b37bdb3
commit 5a8ecd2dc5

View file

@ -907,7 +907,7 @@ public class MessageHelper {
// https://en.wikipedia.org/wiki/International_email
for (Address address : addresses) {
String email = ((InternetAddress) address).getAddress();
email = punyCode(email);
email = punyCode(email, false);
((InternetAddress) address).setAddress(email);
}
return addresses;
@ -2817,7 +2817,7 @@ public class MessageHelper {
if (email != null) {
email = decodeMime(email);
email = punyCode(email);
email = punyCode(email, true);
iaddress.setAddress(email);
}
@ -3569,12 +3569,17 @@ public class MessageHelper {
return TextUtils.join(compose ? ", " : "; ", formatted);
}
static String punyCode(String email) {
static String punyCode(String email, boolean single) {
int at = email.indexOf('@');
if (at > 0) {
String user = email.substring(0, at);
String domain = email.substring(at + 1);
if (single &&
TextHelper.isSingleScript(user) &&
TextHelper.isSingleScript(domain))
return email;
try {
user = IDN.toASCII(user, IDN.ALLOW_UNASSIGNED);
} catch (Throwable ex) {