diff --git a/v2rayN/v2rayN/Handler/UpdateHandle.cs b/v2rayN/v2rayN/Handler/UpdateHandle.cs index a6468fc9..3ba58386 100644 --- a/v2rayN/v2rayN/Handler/UpdateHandle.cs +++ b/v2rayN/v2rayN/Handler/UpdateHandle.cs @@ -212,6 +212,7 @@ namespace v2rayN.Handler _updateFunc(false, $"{hashCode}{args.GetException().Message}"); }; + url = Utils.GetPunycode(url); _updateFunc(false, $"{hashCode}{ResUI.MsgStartGettingSubscriptions}"); var result = await downloadHandle.DownloadStringAsync(url, blProxy, userAgent); if (blProxy && Utils.IsNullOrEmpty(result)) diff --git a/v2rayN/v2rayN/Tool/Utils.cs b/v2rayN/v2rayN/Tool/Utils.cs index 39be59a0..2edd4ece 100644 --- a/v2rayN/v2rayN/Tool/Utils.cs +++ b/v2rayN/v2rayN/Tool/Utils.cs @@ -413,6 +413,30 @@ namespace v2rayN return sb.ToString(); } + public static string GetPunycode(string url) + { + if (string.IsNullOrWhiteSpace(url)) + { + return url; + } + try + { + Uri uri = new Uri(url); + if (uri.Host == uri.IdnHost) + { + return url; + } + else + { + return url.Replace(uri.Host, uri.IdnHost); + } + } + catch + { + return url; + } + } + #endregion