java - How to encode a cookie data in jsp and decode it in php? -
we have created cookie below
cookie usernamecookie = new cookie ("username", urlencoder.encode(snuser.getusername(), "utf-8")); usernamecookie.setpath("/"); usernamecookie.setmaxage(60); response.addcookie(usernamecookie);
but want create cookie encoded data , has decode in php. can 1 please me.
java's urlencoder.encode()
uses same encoding standards php's urlencode()
function.
therefore, decode string has been encoded using java's urlencoder.encode()
, can use php's urldecode()
function.
e.g.
$username_encoded = $_cookie["username"]; $username_decoded = urldecode($username_encoded);
Comments
Post a Comment