]> git.wh0rd.org - tt-rss.git/commitdiff
convert to punycode for feed on idn hostname
authorBernhard Thaler <bernhard.thaler@wvnet.at>
Mon, 2 Jan 2017 21:50:26 +0000 (22:50 +0100)
committerBernhard Thaler <bernhard.thaler@wvnet.at>
Mon, 2 Jan 2017 21:50:26 +0000 (22:50 +0100)
include/functions2.php
install/index.php

index 5b38f1840c7be14f95445b68f8301fb2125022ea..6b6f5aa560b630d393b28f42c44e738fad2dcf78 100644 (file)
                        $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
index 00e90dfe7c8d8db348cfc35d3de9a3f63e7035b5..d9e370ea59b4b81fa36780fc073e12da66e4cca5 100755 (executable)
                        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:");