mirror of https://github.com/2dust/v2rayN
Convert idn domain
parent
529b6613e9
commit
b48037b757
|
@ -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))
|
||||
|
|
|
@ -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
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue