Commit f6bcb5c6 authored by Andrew Dolgov's avatar Andrew Dolgov

Merge branch 'subscribe-idn-feed' into 'master'

Subscribe to feed with Internationalized Domain Name

Currently you cannot subscribe to feeds on hosts with internationalized domain names (IDNA) within tt-rss. You need to manually convert them to punycode to subscribe to them.

This patch adds code to detect IDNA and convert them to punycode in fix_url() if possible on the system. This requires PHP IDN functions (e.g. on Debian Jessie this needs php5-intl to be installed), so a notice is added to the installer sanity check.

See merge request !37
parents 6b06a609 62958fe9
......@@ -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
......
......@@ -309,6 +309,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:");
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment