]> git.wh0rd.org - tt-rss.git/blobdiff - include/functions2.php
convert to punycode for feed on idn hostname
[tt-rss.git] / include / functions2.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