0

This url:

http://www.example.com/موبایل/

And when i want to echo with:

echo $_SERVER['REQUEST_URI'];

Output:

http://www.example.com/%D8%AA%D9%87%D8%B1%D8%A7%D9%86

Main Question:

How can i get above url without these % exactly like what i see in browser search bar, exactly like this:

http://www.example.com/موبایل/
  • 2
    That is url encoded, so use http://php.net/manual/en/function.urldecode.php. – chris85 Nov 27 '17 at 18:25
  • @chris85 so i did this now, it return `?????`, so now what? –  Nov 27 '17 at 18:31
  • 1
    Sounds like the page is not encoded in UTF8. Set the character set of the page to UTF8. https://stackoverflow.com/questions/4279282/set-http-header-to-utf-8-using-php – chris85 Nov 27 '17 at 18:32
  • No @chris85 i set `header` before. in that topic you mentioned as duplicate, it used `utf8_decode` but this `%D8%AA%D9%87%D8%B1%D8%A7%D9%86` not UTF-8, it's `ASCII`. `mb_detect_encoding` return `ASCII` –  Nov 27 '17 at 18:36
  • 1
    It's not ASCII, and don't use `utf8_decode()`, especially on non-latin charsets. https://stackoverflow.com/questions/279170/utf-8-all-the-way-through – Sammitch Nov 27 '17 at 18:43
  • Yes the individual characters in that string are ascii, but when reassembled to the actual character it is not ASCII. `utf8_decode` is for an ISO string, check the manual and can you find the exact one ( you don't want to be using that function, note the comment by @Kornel there). Show the code where you are setting the header. See https://3v4l.org/OclYK – chris85 Nov 27 '17 at 18:49

0 Answers0