mirror of
https://github.com/M66B/FairEmail.git
synced 2024-12-21 23:32:51 +00:00
Skip punycode for single scripts
This commit is contained in:
parent
7a2b37bdb3
commit
5a8ecd2dc5
1 changed files with 8 additions and 3 deletions
|
@ -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…
Reference in a new issue