Skip punycode for single scripts

pull/217/head
M66B 10 months ago
parent 7a2b37bdb3
commit 5a8ecd2dc5

@ -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) {

Loading…
Cancel
Save