Solved

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

Posted on 2011-09-19
3
229 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

Recently I was talking with Tim Sharp, one of my colleagues from our Technical Account Manager team about MongoDB’s scalability. While doing some quick training with some of the Percona team, Tim brought something to my attention...
The goal of this blog is to: > note what has impeded us from reaching effective life on-call > provide 3 steps to mastering life on-call > highlight what will be achieved with effective life on-call
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

751 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