Solved

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

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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Suggested Solutions

Get to know the ins and outs of building a web-based ERP system for your enterprise. Development timeline, technology, and costs outlined.
In this article, I will show you HOW TO: Perform a Physical to Virtual (P2V) Conversion the easy way from a computer backup (image).
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

744 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now