Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2011-09-19
3
Medium Priority
?
246 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:Gurvinder Pal Singh
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:
Gurvinder Pal Singh earned 2000 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

In this article, I’ll show how research, determination, and use of modern technology helped me solve a DNA mystery.
Want to know how to use Exchange Server Eseutil command? Go through this article as it gives you the know-how.
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses

664 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