urlencode() and urldecode() should work.