473,387 Members | 1,864 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

urlencode and urldecode properly

I pass three variables through javacripting and these variable fetch from flash.

Expand|Select|Wrap|Line Numbers
  1. window.open("http://www.abc.com/postcomment.php?nID="+id + "&song_name=" +songname + "&artist_name=" +artistname);
  2.  
Inside variable have Arabic character (UTF-8) and Url should like this:
http://www.abc.com/postcomment.php ... song_name=ويتميز ايو&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:
Expand|Select|Wrap|Line Numbers
  1. function getCurrentPageUrl()
  2.         {
  3.                 $pageURL = 'http';
  4.                 if ($_SERVER["HTTPS"] == "on")
  5.                 {
  6.                         $pageURL .= "s";
  7.                 }
  8.  
  9.                 $pageURL .= "://";
  10.                 if ($_SERVER["SERVER_PORT"] != "80")
  11.                 {
  12.                         $pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
  13.                 }
  14.                 else
  15.                 {
  16.                         $pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
  17.                 }
  18.  
  19.                 $url=urlencode($pageURL);
  20.                 $result=urldecode($url);
  21.                 return $result;
  22.         }
  23.  
i call function when user sucessfully login:
Expand|Select|Wrap|Line Numbers
  1. passurl=getCurrentPageUrl();
  2. header("Location:$passurl");
But i get incorrect url in internet explorer:
http://www.abc.com/postcomment.php?n...?????%20??????

and i get the correct url in firefox & google chrome as mentioned below:
http://www.abc.com/postcomment.php ... song_name=ويتميز ايو&artist_name=مزيج المسا
Oct 3 '11 #1
2 3790
johny10151981
1,059 1GB
your page will have to clearly know what kind of encoding you are using. that is, you must have to tell your brwoser clearly. example
Expand|Select|Wrap|Line Numbers
  1. <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
In this case your page wont suffer with transferring data
Oct 4 '11 #2
I already declare encoding in index.php and as well postcomment.php.
Expand|Select|Wrap|Line Numbers
  1. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
Oct 4 '11 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

13
by: Jim Andersen | last post by:
Hi, Is there an equivalent to URLdecode() in javascript ? Details: In Asp.Net I am using HttpContext.Current.Response.Redirect("genericerror.htm?ErrStr=" & Err.Number & ": " &...
1
by: DC Gringo | last post by:
I am having trouble building a URL the serves up an image dynamically...something involving the & separating my URL parameters. If I put the same URL in with & instead of the code-generated &amp;,...
0
by: Chris | last post by:
Just a curiosity: Is it standard practice to UrlEncode and UrlDecode cookie values? I wouldn't have even stumbled across this except I noticed that when I retrieve a cookie that was set with...
2
by: Grey | last post by:
How can I use the URLEncode in ASP.NET?? If i used URLEncode to encode the URL, how can I decode the URL with proper parameter values in ASP.NET?? I can encode the URL, but i cannot decode it...
2
by: Nic | last post by:
Hello all, I ran into a problem encoding/decoding special characters in URLs. by using Server.UrlEncode and Server.UrlDecode. Basically, encoding x+y results in x%2by, however decoding x%2by...
2
by: Marc Cardinal | last post by:
I have a need to encode and decode url content. I'm currently using the UrlDecode and UrlEncode methods from the HttpUtility class. However the code must be able to run under the .Net Internet...
10
by: Alex | last post by:
Hi, I UrlEncode a value that I put in my querystring. This value originally contains the character "", which is UrlEncoded to "%E8". When I try to read the value from the querystring, I find...
1
by: fjm67 | last post by:
I see Google edited my email address. Lets try this. captonline at yahoo dot com Can you guys help me out please? I need to implement urldecode into a php script and don't know how. Here is...
1
by: lookaround | last post by:
Hi, I have a problem with UrlEncoding/UrlDecoding. I have two chars (東京); the HTTPUtility.UrlEncode writes in the html the text: %e6%9d%b1%e4%ba%ac The Request.Querystring.ToString() of...
6
by: CindyH | last post by:
Hi I'm not sure whether I should send this as a new message or use the one I've been using but... I'm using vb.net 2.0 - My problem is I need to send something like this: 'dim encodedstring =...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.