From 4c3c1b12e45060e0622594e8372f478c94691ae8 Mon Sep 17 00:00:00 2001 From: M66B Date: Fri, 8 Jul 2022 21:37:07 +0200 Subject: [PATCH] IDN for owner check --- app/src/main/java/eu/faircode/email/IPInfo.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/src/main/java/eu/faircode/email/IPInfo.java b/app/src/main/java/eu/faircode/email/IPInfo.java index cb1a2e1eda..124f35d84c 100644 --- a/app/src/main/java/eu/faircode/email/IPInfo.java +++ b/app/src/main/java/eu/faircode/email/IPInfo.java @@ -29,6 +29,7 @@ import androidx.core.net.MailTo; import java.io.FileNotFoundException; import java.io.IOException; +import java.net.IDN; import java.net.InetAddress; import java.net.URL; import java.net.UnknownHostException; @@ -57,6 +58,11 @@ public class IPInfo { String host = uri.getHost(); if (host == null) throw new UnknownHostException(); + try { + host = IDN.toASCII(host, IDN.ALLOW_UNASSIGNED); + } catch (Throwable ex) { + Log.i(ex); + } InetAddress address = InetAddress.getByName(host); return new Pair<>(address, getOrganization(address, context)); }