Web lists-archives.com

[PHP] parse_url and the charsets ...




Hi, all

I lately ran into the issue, that the method parse_url() does not give
the expected result if you pass in a URL like "http://localhost/2 -
English title 2 (fi) здесь.mp3?download=1".

Here is the code I tried:

var_dump(parse_url("http://localhost/2 - English title 2 (fi)
здесь.mp3?download=1"));

And here is the result I got when running it on my local machine:

array(4) {
  ["scheme"]=>
  string(4) "http"
  ["host"]=>
  string(9) "localhost"
  ["path"]=>
  string(41) "/2 - English title 2 (?_) зде?_?_.mp3"
  ["query"]=>
  string(10) "download=1"
}

But I more expected to get a result like this:

array(4) {
  ["scheme"]=>
  string(4) "http"
  ["host"]=>
  string(9) "localhost"
  ["path"]=>
  string(41) "/2 - English title 2 (fi) здесь.mp3"
  ["query"]=>
  string(10) "download=1"
}

What setting in PHP is the one being responsible for this change?
Because I saw it working in every PHP version on 3v4l: https://3v4l.org/5hXSH

Bye,
Simon

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php