It's not a secret anymore!
The moose likes HTML, CSS and JavaScript and the fly likes Encoded string comparison Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Encoded string comparison" Watch "Encoded string comparison" New topic

Encoded string comparison

Rob Hunter
Ranch Hand

Joined: Apr 09, 2002
Posts: 832
Hi All,
I have a group of radio buttons with their values set to specific expressions - each one with a PI symbol. There is a value stored in a cookie with one of the expressions within the radio buttons' values. If I grab the value from the cookie to compare with the selected values from the radio buttons I get π in place of the PI symbol for the answer from the cookie and from the values from the radio buttons I get the actual symbol (i.e. N). How can I easily compare the value from within the cookie with the HTML equivalent on the page? Any help would be most appreciated.

Stefaan Dutry
Ranch Hand

Joined: Sep 17, 2010
Posts: 32

Try using encodeURIComponent() when saving the value to your cookie and decodeURIComponent() for when you're getting the value from your cookie.
I agree. Here's the link:
subject: Encoded string comparison
It's not a secret anymore!