Question

I am curious to know which encoding is used for jsessionid.

The jsessionid value always contains only alphanumeric characters but nothing else, which makes that kind of encoding safer to user in URLs.

Was it helpful?

Solution

There's no standard for the format of the session ID.

But if you ever want to encode something to just alphanumeric, specifically a number, you can simply convert it to BASE 36, it's like hexadecimal but where hex stops at F, BASE 36 goes all the way up to Z. Straight forward.

OTHER TIPS

The encoding for JSESSIONID is of no conceivable interest since there is no specification for what the contents are, other than that they are unique among currently valid sessions.

The proper encoding for URLs is provided by the URI class. For example a filename can be encoded thus:

String encodedPath = new URI(null, filename, null).toASCIIString();

The proper encoding for parameters within URLs, or within POST data, is provided by URLEncoder (which is misnamed).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top