将Url传递到另一个页面的最佳方式

I have pass url to another page via javascript .For example www.example.com/share.php?url=http://google.com/ (I create whole url via javascript , I add my url variable to static string (which is www.example.com/share.php?url= ) and I redirect user to this page). But while I am passing url variable to share script , special characters(ğüşiöç) in url change or disappear. What should I do to Url string to keep it unchanged .

Use the encodeURIComponent function before your url.