Solved

cookies[loop].getValue() breaking when the value includes an @ symbol

Posted on 2011-09-19
3
237 Views
Last Modified: 2012-05-12
Hi,

I'm working on a legacy system and having a problem with cookies.

A user's email address is being stored as a cookie and later used as the usersID

Although it was working fine, recently when the cookie is called it returns only text before the @ symbol.

For example:

cookie value = 'name@domain.com'

getting the cookie value = 'userID = cookies[loop].getValue()'

Returns = 'name'

Not 'name@domain.com'

Is there a way of escaping the @ ? Open to any suggestions.
0
Comment
Question by:o-roojo
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 40

Expert Comment

by:gurvinder372
ID: 36559749
use escape(value) while setting the cookie
0
 

Author Comment

by:o-roojo
ID: 36559852
HI could you expand on your answer a little I've tried the following with no success:

Cookie cookieUserId = new Cookie("cookieUserId",escape(email));
                  response.addCookie(cookieUserId);

or
string address="";
address = escape(email);
Cookie cookieUserId = new Cookie("cookieUserId",address);
                  response.addCookie(cookieUserId);

As the tags to this question state this is JSP not javascript - if that makes a difference?
0
 
LVL 40

Accepted Solution

by:
gurvinder372 earned 500 total points
ID: 36559877
okay
Check this doc
http://www.javacommerce.com/displaypage.jsp?name=servletfaq.sql&id=18248
see this section's note below
(What are Cookies and how to use them?)

see this
http://blog.js-development.com/2009/03/problems-with-character-encoding-on.html
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

With the rising number of cyber attacks in recent years, keeping your personal data safe has become more important than ever. The tips outlined in this article will help you keep your identitfy safe.
This article explains the fundamentals of industrial networking which ultimately is the backbone network which is providing communications for process devices like robots and other not so interesting stuff.
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

626 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question