Page 1 of 1

problem in urlencode

Posted: Mon Oct 03, 2011 8:04 am
by salman1karim
I pass three variables through javacripting and these variable fetch from flash.

window.open("http://www.abc.com/postcomment.php?nID="+id + "&song_name=" +songname + "&artist_name=" +artistname);

Inside variable have Arabic character (UTF-8) and Url should like this:
http://www.one12two.com/postcomment.php ... ame=ويتميز ايو&artist_name=مزيج المسا

Before opening the page checked the user log in information. If not then went to login page after user successful log in it will come to last page from where user are giving comments. But the problem is that when I read url from urlencode() and after decode in php. It's working in mozila firefox but in internet explorer is not working. Php code is mentioned below:

Code: Select all

function getCurrentPageUrl()
	{
		$pageURL = 'http';
		if ($_SERVER["HTTPS"] == "on")
		{
			$pageURL .= "s";
		}

		$pageURL .= "://";
		if ($_SERVER["SERVER_PORT"] != "80")
		{
			$pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
		}
		else
		{
			$pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
		}

		$url=urlencode($pageURL);
		$result=urldecode($url);
		return $result;
	}
i call function when user sucessfully login:

Code: Select all

passurl=getCurrentPageUrl();
header("Location:$passurl");
But i get incorrect url in internet explorer:
http://www.abc.com/postcomment.php?nID= ... ???????%20?????? ??????&artist_name=????????????%20??????

and i get the correct url in firefox & google chrome as mentioned below:
http://www.abc.com/postcomment.php ... song_name=ويتميز ايو&artist_name=مزيج المسا

Re: problem in urlencode

Posted: Mon Oct 03, 2011 9:35 am
by egg82
IE is not a standars-compliant browser. That said, you have two options:
1. Edit ALL of your code to comply to IE
2. Do not allow IE to access your website

as far as #1, you should look up "$_SERVER["SERVER_NAME"] IE" and "$_SERVER["REQUEST_URI"] IE" on google
#2, go to http://php.net/manual/en/function.get-browser.php