wood burning stoves 2.0*
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


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Encoded string comparison" Watch "Encoded string comparison" New topic
Author

Encoded string comparison

Rob Hunter
Ranch Hand

Joined: Apr 09, 2002
Posts: 823
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.

RH
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.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Encoded string comparison