2

I want to create a cookie that it's value contains many ";" characters that is usually used to separate multiple cookies in java, that's why my code isn't making his job. if someone can help me how to create this "special" cookie and make my code work? thanks.

user1504712
  • 23
  • 2
  • 5

2 Answers2

5

You can use URL encoding to escape any special characters (+, %, =, ;).

The URL encoded value of ; is %3B.

For a better reference, check out the Java JSON API.

Ian Bishop
  • 5,185
  • 3
  • 26
  • 37
4

Semicolon is not allowed in cookies. Your best shot is to use some other separator. Read the linked answer to figure out what character can be used.

Community
  • 1
  • 1
Hari Menon
  • 33,649
  • 14
  • 85
  • 108
  • I actually have a cookie that contains some Semicolons, even if it is forbidden, i have to create one cookie with that value, isn't there a way to encode the cookie or somthing so that the Semicolons in it's value don't make the separation in it? – user1504712 Jul 05 '12 at 17:18