Win a copy of Soft Skills: The software developer's life manual this week in the Jobs Discussion forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Encoded string comparison

 
Rob Hunter
Ranch Hand
Posts: 832
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 32
Eclipse IDE Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic