summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2017-01-16 11:36:00 +0300
committerAndrew Dolgov <[email protected]>2017-01-16 11:36:00 +0300
commitf6bcb5c60687f6d8d57612057996852e144c8c61 (patch)
treed1f9f28d6fbebbfb7b064f68c83c847066b0ec3d /include
parent6b06a609affe4e246974d745f9d01b448bae0f17 (diff)
parent62958fe9dcc72a9b93e8b9259c580a472fb3ce7f (diff)
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
Diffstat (limited to 'include')
-rw-r--r--include/functions2.php10
1 files changed, 10 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