|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #59652 idn_to_ascii returns invalid url for utf-8 in host
Submitted: 2011-03-05 18:22 UTC Modified: 2011-03-05 18:48 UTC
From: jctest at hotmail dot com Assigned:
Status: Not a bug Package: idn (PECL)
PHP Version: 5.3.3 OS: Ubuntu 9.3
Private report: No CVE-ID: None
 [2011-03-05 18:22 UTC] jctest at hotmail dot com
I am trying to encode urls with the function idn_to_ascii. It 
works well except when the host contains utf-8 characters, 
like ? ? and ? and without a protocol. It returns OK, but it 

Thank you.

Reproduce code:
$url = "http://t?";
$asciiurl = idn_to_ascii($url);

Although $url = "http://www.t?" returns expected result. Also $url = "http://somethingelse.t?" returns expected result. It's just when http://hostwith???.com it fails.

Expected result:
Expected url returned:

Actual result:
The url returned: xn-- (not a valid http 


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2011-03-05 18:33 UTC] jctest at hotmail dot com
Sorry, the expected returned result should be http://xn--tst- (without www)
 [2011-03-05 18:48 UTC] johannes at schlueters dot de
Thank you for taking the time to write to us, but this is not
a bug.

The function is not supposed to work on a URL but a host name. Use parse_url() if needed.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Jun 23 14:01:30 2024 UTC