diff options
author | Bernhard Thaler <[email protected]> | 2017-01-02 22:50:26 +0100 |
---|---|---|
committer | Bernhard Thaler <[email protected]> | 2017-01-02 22:50:26 +0100 |
commit | 62958fe9dcc72a9b93e8b9259c580a472fb3ce7f (patch) | |
tree | 32eb6ecbd271b866bbdebb8bee1440fefdcf1b50 | |
parent | 832aa24943f6b65a811dc6c7414dede412ab1ec6 (diff) |
convert to punycode for feed on idn hostname
-rw-r--r-- | include/functions2.php | 10 | ||||
-rwxr-xr-x | install/index.php | 4 |
2 files changed, 14 insertions, 0 deletions
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 diff --git a/install/index.php b/install/index.php index 00e90dfe7..d9e370ea5 100755 --- a/install/index.php +++ b/install/index.php @@ -317,6 +317,10 @@ array_push($notices, "CURL and open_basedir combination breaks support for HTTP redirects. See the FAQ for more information."); } + if (!function_exists("idn_to_ascii")) { + array_push($notices, "PHP support for Internationalization Functions is required to handle Internationalized Domain Names."); + } + if (count($notices) > 0) { print_notice("Configuration check succeeded with minor problems:"); |