?
Solved

cookie returns hex code for special characters

Posted on 2003-03-02
8
Medium Priority
?
253 Views
Last Modified: 2012-08-13
hi All,
when i am writing a cookie with value such as : !qwE1+*=
the server creates that cookie fine
but , when i am trying to get that cookie back or when i open it with notepad
the values inside are inserted hexadecimal as follow :
x0021qwE1x002bx002ax003d

what can i do to get the characters normaly
thanks
Avi Algaly
0
Comment
Question by:aavi
[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
  • 5
  • 3
8 Comments
 
LVL 46

Expert Comment

by:fritz_the_blank
ID: 8051837
When you read your cookie, try using the unescape function:

strText = unescape(document.cookie)

Fritz the Blank
0
 

Author Comment

by:aavi
ID: 8052039
Hi Fritz the Blank
it doesnt work
here's the code
     Set app = Server.CreateObject("com.citrix.nfuse.App")
     If Not Request.ServerVariables("REQUEST_METHOD") = "POST" Then
          user = Request.Cookies("NFuseData")("NFuse_User")
          domain = Request.Cookies("NFuseData")("NFuse_Domain")
          password = Request.Cookies("NFuseData")("NFuse_Password")
     Else
          user = unescape(app.urlEncode(Request.Form("user")))
          domain = unescape(app.urlEncode(Request.Form("domain")))
          password = unescape(app.urlEncode(Request.Form("password")))
          response.Write(user&"<br>"&password&"-->from form")
          If (user = "") Then
               response.Write("Problem Occured ")
               response.end
          Else
               Response.Cookies("NFuseData")("NFuse_User") = user
               Response.Cookies("NFuseData")("NFuse_Domain") = domain
               Response.Cookies("NFuseData")("NFuse_Password") = password
                         End If
     End If
0
 
LVL 46

Expert Comment

by:fritz_the_blank
ID: 8052048
Actually, that code I gave you was client-side javascript. For server side coding, you could try:

Server.HTMLEncode

Fritz the Blank
0
Industry Leaders: 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!

 
LVL 46

Expert Comment

by:fritz_the_blank
ID: 8052060
Is this any better?

    Set app = Server.CreateObject("com.citrix.nfuse.App")
    If Not Request.ServerVariables("REQUEST_METHOD") = "POST" Then
         user = Request.Cookies("NFuseData")("NFuse_User")
         domain = Request.Cookies("NFuseData")("NFuse_Domain")
         password = Request.Cookies("NFuseData")("NFuse_Password")
    Else
         user = app.HTMLEncode(Request.Form("user"))
         domain = app.HTMLEncode(Request.Form("domain"))
         password = app.HTMLEncode(Request.Form("password"))
         response.Write(user&"<br>"&password&"-->from form")
         If (user = "") Then
              response.Write("Problem Occured ")
              response.end
         Else
              Response.Cookies("NFuseData")("NFuse_User") = user
              Response.Cookies("NFuseData")("NFuse_Domain") = domain
              Response.Cookies("NFuseData")("NFuse_Password") = password
                        End If
    End If

Fritz the Blank
0
 

Author Comment

by:aavi
ID: 8052160
my app object does not support this kind of metod
0
 
LVL 46

Accepted Solution

by:
fritz_the_blank earned 280 total points
ID: 8052179
Sorry, I had a brain fart there, I meant to post:

    Set app = Server.CreateObject("com.citrix.nfuse.App")
    If Not Request.ServerVariables("REQUEST_METHOD") = "POST" Then
         user = Request.Cookies("NFuseData")("NFuse_User")
         domain = Request.Cookies("NFuseData")("NFuse_Domain")
         password = Request.Cookies("NFuseData")("NFuse_Password")
    Else
         user = Server.HTMLEncode(Request.Form("user"))
         domain = Server.HTMLEncode(Request.Form("domain"))
         password = Server.HTMLEncode(Request.Form("password"))
         response.Write(user&"<br>"&password&"-->from form")
         If (user = "") Then
              response.Write("Problem Occured ")
              response.end
         Else
              Response.Cookies("NFuseData")("NFuse_User") = user
              Response.Cookies("NFuseData")("NFuse_Domain") = domain
              Response.Cookies("NFuseData")("NFuse_Password") = password
                        End If
    End If



Fritz the Blank
0
 

Author Comment

by:aavi
ID: 8052241
thank you very much "fritz_the_blank"
you've realy helped me ALOT
its good to have people like you around
thanks,
Avi Algaly
0
 
LVL 46

Expert Comment

by:fritz_the_blank
ID: 8052266
I am glad to have helped. I am sorry for the messed up earlier posts--I am working on too many things at once this morning and am making stupid mistakes.


Good luck with your project,

Fritz the Blank
0

Featured Post

Industry Leaders: 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

I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Suggested Courses

777 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