From 62958fe9dcc72a9b93e8b9259c580a472fb3ce7f Mon Sep 17 00:00:00 2001 From: Bernhard Thaler Date: Mon, 2 Jan 2017 22:50:26 +0100 Subject: convert to punycode for feed on idn hostname --- include/functions2.php | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'include/functions2.php') diff --git a/include/functions2.php b/include/functions2.php index 5b38f1840..6b6f5aa56 100644 --- a/include/functions2.php +++ b/include/functions2.php @@ -1776,6 +1776,16 @@ $url .= '/'; } + //convert IDNA hostname to punycode if possible + if (function_exists("idn_to_ascii")) { + $parts = parse_url($url); + if (mb_detect_encoding($parts['host']) != 'ASCII') + { + $parts['host'] = idn_to_ascii($parts['host']); + $url = build_url($parts); + } + } + if ($url != "http:///") return $url; else -- cgit v1.2.3