Solved

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

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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

An article on effective troubleshooting
This article outlines the process to identify and resolve account lockout in an Active Directory environment.
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…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

772 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